public void UnEscapesData() { // Arrange const string content = "MSH|^~\\&|TestSys|432^testsys practice|TEST||201402171537||MDM^T02|121906|P|2.3.1||||||||\r" + "OBX|1|TX|PROBLEM FOCUSED^PROBLEM FOCUSED^test|1|\\T\\#39;Thirty days have September,\\X0D\\April\\X0A\\June,\\X0A\\and November.\\X0A\\When short February is done,\\E\\X0A\\E\\all the rest have\\T\\nbsp;31.\\T\\#39"; var parser = new PipeParser(); var msg = parser.Parse(content); // Act var segment = msg.GetStructure("OBX") as ISegment; var idx = Terser.GetIndices("OBX-5"); var segmentData = Terser.Get(segment, idx[0], idx[1], idx[2], idx[3]); // Assert // verify that data was properly un-escaped by NHapi // \E\X0A\E\ should be escaped to \X0A\ // \X0A\ should be un-escaped to \n - this is configurable // \X0D\ should be un-escaped to \r - this is configurable // \t\ should be un-escaped to & const string expectedResult = "'Thirty days have September,\rApril\nJune,\nand November.\nWhen short February is done,\\X0A\\all the rest have 31.'"; Assert.AreEqual(expectedResult, segmentData); }