I'm using the HAPI-FHIR library's generic RESTful client to communicate with a FHIR server which is occasionally delivering some unclean XML, but the errors can be avoided if I use JSON.
This is easy to override in client.search() by adding .encodedJson() to the fluent chain (as mentioned on the documentation intro page). However, some methods (e.g. client.read(...)) don't seem to have any way to set the encoding, so they accept whatever the server sends by default.
Is there perhaps a way to set a default encoding in the context or client creation so it applies wherever they are used?