-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Partially implement translate_newlines config in JVM backend's DecoderInstance #724
Partially implement translate_newlines config in JVM backend's DecoderInstance #724
Conversation
Add a boolean member for it (defaults to false) and set it based on the config hash if given. Currently only takeAllChars uses it, because that's all that was needed to get both t/nqp/019-file-opt.t and t/nqp/116-streaming-decoder.t to pass on Windows.
@@ -156,7 +159,8 @@ public synchronized String takeAllChars(ThreadContext tc) { | |||
decoder.flush(target); | |||
decoder.reset(); | |||
} | |||
return Normalizer.normalize(decodedBuffer(target), Normalizer.Form.NFC); | |||
String normalized = Normalizer.normalize(decodedBuffer(target), Normalizer.Form.NFC); | |||
return translate_newlines ? normalized.replace("\r\n", "\n") : normalized; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should happen in takeChars
and takeAvailableChars
too, probably by factoring out this line into a method. Otherwise it seems to be doing the right thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, I'll give that a shot and see what happens.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. No change in tests.
Also pull it out into a method.
Fixed with Raku/nqp#724.
Add a boolean member for it (defaults to false) and set it based on the
config hash if given.
Currently only takeAllChars uses it, because that's all that was needed
to get both t/nqp/019-file-opt.t and t/nqp/116-streaming-decoder.t to
pass on Windows with the JVM backend.
This will allow us to turn back on the JVM-on-Windows NQP test job in CI, which I accidentally did in #719, so after a rebase that PR should all pass.