logicahealth / InfoButtons

Infobuttons are context-sensitive links embedded in the electronic health record (EHR). They use clinical context information from the EHR, such as patient demographics, medications, diagnoses, user role, and clinical setting to help find answers to clinicians' and patients' questions using online health information resources.
28 stars 29 forks source link

XML Output fails when Spanish Language is selected for Information Recipient #18

Open appliedhcs opened 7 years ago

appliedhcs commented 7 years ago

Hi! We are encountering an issue when XML is selected as an output and Spanish is selected as language for Information Recipient to generate an URL from "Test Resource" link in LITE. Same is failing when tried to perform same task at http://lite.bmi.utah.edu/InfobuttonQA.html (LITE from University of Utah). Below is the reported error: This page contains the following errors: error on line 1 at column 4771: Encoding error

Any help to resolve this issue is greatly appreciated.

aniskand commented 7 years ago

Hmmm, it seems to be failing on the character ú in the summary text it receives from MedLinePlus. What's odd is when set to JSON it returns the character just fine. Also, if I use a REST client instead of a browser to make the request, like https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo/related?hl=en-US , it also works although without properly decoding the character.

I will have to investigate this further and see if there is anything I can do. This seems to be an issue with how the return is being parsed by your browser/client rather than the response that is being generated by the OpenInfobutton. Or maybe I need to set a different character encoding type in the header for non-english language responses. This isn't really something we've tested much so thanks for letting us know. I can't really promise a quick fix or even give you a timeframe so for the time being I would just avoid using XML with non-English responses.

appliedhcs commented 7 years ago

Hi Aniskand,

Thank you very much for your quick response and initial input. It is understood that it may take a bit of time to resolve this issue. I agree that perhaps the change of character type in the header for non-English language might be a quick fix. Please keep us in the loop of any update and in mean time we will attempt to use JSON response for non-English requests.

Thank you.

aniskand commented 7 years ago

Ok, looking at this again, I think the problem is the summary text we get from resources that support the HL7 Knowledge Response isn't being UTF-8 encoded before being added to the response. I can probably fix this on my end, but again, no timeframe. Thanks.