FHIR Chat · Use of HTML entities in JSON narrative · implementers

Stream: implementers

Topic: Use of HTML entities in JSON narrative


view this post on Zulip Ruben Pape (Mar 20 2019 at 13:35):

Hi, I have a question regarding the use of HTML entities in the narrative when using JSON as representation format. The STU3 specs mention the following about this (http://www.hl7.org/fhir/STU3/narrative.html):
"Note that the XHTML is contained in general XML so there is no support for HTML entities like   or © etc. Unicode characters SHALL be used instead. Unicode   substitutes for  ."
This phrase refers to a narrative in XML format, but it is unclear if the same applies to narratives in JSON. Could someone clarify this? Thanks!

view this post on Zulip Lloyd McKenzie (Mar 20 2019 at 13:54):

It applies to JSON too.

view this post on Zulip Ruben Pape (Mar 20 2019 at 13:59):

Ok clear, thanks! What's the reason to apply this constraint on JSON too, if I may ask?

view this post on Zulip Lloyd McKenzie (Mar 20 2019 at 15:15):

The data needs to be portable between the JSON, XML and RDF

view this post on Zulip Ruben Pape (Mar 20 2019 at 15:24):

Right, that makes sense. Thanks!

view this post on Zulip Gijsbert van den Brink (Mar 26 2019 at 10:56):

Then hapi-fhir outputs invalid JSON. When using XML, HTML entities in narratives are converted to their unicode characters, but not when using JSON. I made a bug report on GitHub a while ago: https://github.com/jamesagnew/hapi-fhir/issues/1160

view this post on Zulip Lloyd McKenzie (Mar 26 2019 at 14:50):

@James Agnew

view this post on Zulip Gijsbert van den Brink (Apr 09 2019 at 10:43):

@James Agnew Can you please confirm that this is a bug in hapi-fhir? And if it is, any idea when this can be fixed?


Last updated: Apr 12 2022 at 19:14 UTC