nodengine-hl7 icon indicating copy to clipboard operation
nodengine-hl7 copied to clipboard

[FIXED] Parser incorrectly grabbing whitespace chars in the beginning…

Open jjviscomi opened this issue 7 years ago • 5 comments

… of messages

These are ending from the previous lines \r\n

jjviscomi avatar Mar 28 '17 18:03 jjviscomi

Is there a test you can add for this?

evanlucas avatar Apr 04 '17 13:04 evanlucas

@evanlucas what would you suggest, I assumed your existing tests would have been validating message parsing. I would be happy to add something per your suggestion.

jjviscomi avatar Apr 13 '17 21:04 jjviscomi

@jjviscomi The tests are. That is where I'm a little confused. Do you have an example of where this actually fails?

evanlucas avatar Apr 17 '17 13:04 evanlucas

@evanlucas this primarily has to do with properly consuming the whitespace at the end of a line. moving HL7 files between different OS's the end-of-line encodings can change. Windows is primarily CRLF (char(13)+char(10)) or \r\n. While on unix/linux/osx it is LF. This simply applies trim after you parse out a new line and strips any leading or trailing whitespace, since this is not allowed in HL7, but can been induced as a side effect from transferring files. I will grab a ADT message with the two different encodings with fake data and attach it later.

jjviscomi avatar Apr 18 '17 21:04 jjviscomi

@evanlucas I am attaching two files they are identical parse them both with and without my changes. Feedback will be appreciated.

crlf-lab.txt lf-lab.txt

jjviscomi avatar May 09 '17 01:05 jjviscomi