Joe Lat
Joe Lat

Reputation: 81

How to Retain UTF character in HAPI FHIR Message

I am using HAPI FHIR Libraries and receiving an XML-based FHIR message as a response to a REST call, which is stored in a string variable. This message contains UTF-8 characters such as tabs, new lines, and special characters. However, when converting the string response message to a Bundle object, these characters are being removed. Attaching example as a picture, as UTF chars are getting converted into new line and tab.

enter image description here

Below is the piece of code:

private void processResponse(String response) {
        Bundle bundle = FhirContext.forDstu2_1().newXmlParser().parseResource(Bundle.class, response);
}

I need these UTF characters to remain AS-IS in the message so that they can be used further in the UI.

Upvotes: 0

Views: 47

Answers (0)

Related Questions