Currently I am learning how to work with HL7 and how to parse it in python. Now I was wondering what happens if a value in a HL7 segment contains a pipe sign, eg '|'. How is this sign handled? If there is no masking, it would lead to a crash of the HL7 parser. Is there a masking possibility?
\\F\\
You should read the relevant sections of chapter 2 of the version 2 standard about how escaping works in version 2.
The HL7 structure has defined escape sequences for the separators like |
. When you look at a HL7 message, the used five delimiters are right after the MSH:
MSH|^~\&
F
S
R
E
T
So to escape one of the special characters like |
, you have to take the escape character and then add the defined letter (F,S, etc.)
So in above case, to escape the |
you would have to put \\F\\
. Or escaping the escape character is \\E\\
.
If you like you can also change the delimiters after the MSH completely, but I don't recommend that.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.