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

Backslash is swallowed when unescaping sequence like `\E\R\`

Open fathom-piotr opened this issue 3 months ago • 1 comments

See this example piece of code:

msg = hl7.Message(separator="\r", sequence=[["MSH", "^~\\&"]])
unescaped = msg.unescape("\\E\\R\\")

unescaped should be \R\ because:

  • the first \E\ becomes a literal \
  • we're left with R\

The library, however, returns \R, as if the trailing slash could be skipped.

fathom-piotr avatar Oct 07 '25 08:10 fathom-piotr