Using carriage return <cr> in a HL7 message
Asked Answered
D

1

15

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:

  1. Use line feed (\n) instead
  2. Use this special escape sequence \.br\
  3. Escape it like this \x0d\
  4. Something different?

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?

Dissentient answered 11/8, 2014 at 9:26 Comment(0)
M
9

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

Moralist answered 11/8, 2014 at 10:50 Comment(1)
From the version 2.3.1 HL7 standard: "..The escape character is whatever display ASCII character is specified in the Escape Character component of MSH-2-encoding characters..", you can read more in compressed form at hermetechnz.com/Documentation/sqlschema/…Mcintire

© 2022 - 2024 — McMap. All rights reserved.