Encoding characters are special characters used to construct an HL7 message, defining how data is separated in an HL7 message. Below are the encoding characters:
- Field Separator (normally |)
- Component Separator (normally ^)
- Subcomponent Separator (normally &)
- Field Repeat Separator (normally ~)
- Escape Character (normally \)
Encoding characters are defined dynamically in the MSH segment. The character immediately following the segment “MSH” is the first encoding character, which is the field separator. The rest of the encoding characters are defined in MSH-2, where the four characters in this field define the component separator, repetition separator, escape character, and subcomponent separator in that respective order.
In an HL7 message , sometimes the actual data in a field may contain an encoding character, which will require some data manipulation for the message to be sent correctly. For example, keep in mind that the escape character for the subcomponent separator is “&”, data in a message may contain the following: “Patient must rest & ice the knee”. In this case, a system may treat the field in which this data is located as two subcomponents, although it really should be treated as a single field because the “&” is meant to mean “and” and not a subcomponent separator.
Additional information can be found on the HL7 Resource pages on the following topics:
Visit the Lyniate blog for insights on working with HL7 messaging and other healthcare IT observations.