libyaml-safer
libyaml-safer copied to clipboard
Fix for CRLF
Thanks for creating this library! I've been working with it for a couple of months, mostly using the event-based Parser API.
One thing I've noticed is that CRLF line endings are not working (I work on a Windows machine), in that they are resulting in double-line feeds (\n\n) in strings coming out of the library, and incorrect line numbers in Marks.
I believe the fix is very simple. Line 143 of scanner.rs (in read_line_break) should read:
if let ('\r', Some('\n')) = (front, self.buffer.get(1).copied()) {
Similar to line 111, and to the corresponding libyaml implementation (https://github.com/yaml/libyaml/blob/1e66c1e13a50577bd7ad76abec61ba436d0145bd/src/scanner.c#L533)
I cloned locally and made this change, and it did resolve my issue. I have not done any further testing. I'm happy to open a PR but I'm not sure if you're accepting contributions to this repo.
If this is still relevant, please do submit a PR, I would be happy to look at it. :-)