I am using ca.uhn.hl7v2.util.Terser to create a HL7 message. For one of the HL7 fields I need to set the following value
"\home\one\two".
HL7 message type is MDM_T02(version is 2.3.1). Because "" is an escape character in hl7 messages if I try to use
public void methodOne() {
MDM_T02 mdmt02 = new MDM_T02();
Terser terser = new Terser(mdmt02);
terser.set("OBX-5-1", "\\\\usne-server\\Pathology\\Quantum");
}
In the HL7 message OBX-5-1 is printed as "\E\E\usne-server\E\Pathology\E\Quantum".
Can someone help me to print the proper message?
You may refer to the description of HL7 Escape Sequences here or here.
If
\is part of your data, you need to escape it with\E\.So your value:
becomes
About second issue:
While reading the value, you have to reverse the process. That means, you should replace
\E\with\back to get original value.