The carriage return
character (alias <cr>
, \r
or \x0d
) is the designated segment terminator in a HL7 message.
Therefore this character is prohibited to be used in a field. However, some data may consist of line breaks. How is a line break encoded then? What is the way to go here? What's best practice?
There are some options I see:
\n
) instead\.br\
\x0d\
Which of these options are valid? What can I expect to see in a HL7 message? How should I encode line breaks in my own HL7 messages?
In formatted text fields FT your number 2 is the valid solution.
A different approach e.g. in reports or observation is to put every line in TX fields in a single segment and repeat the segments or to repeat the data fields with ~ .
In binary encapsulated data fields ED you have to use the relevant encoding e.g. Hex or Base64.
This does not exclude that you will see different ways may they be valid or not