Skip to content
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

Improve PumpReader surrogate char handling #720

Merged
merged 1 commit into from
Oct 17, 2021
Merged

Improve PumpReader surrogate char handling #720

merged 1 commit into from
Oct 17, 2021

Conversation

Marcono1234
Copy link
Contributor

Addresses the additional notes in #658 and #659

Improves PumpReader surrogate char handling by making sure that the reader blocks when an incomplete surrogate pair (i.e. only a high surrogate char) is encountered.

Additionally changes the reading logic to consume pending data even if the reader has been closed. Otherwise it would be impossible to read a trailing high surrogate char because CharsetEncoder.encode was previously always called with endOfInput=false and therefore would have never encoded that trailing high surrogate char at the end of the stream (maybe that was intended?).

The added AssertionErrors should not be reachable, even for invalid / incomplete input, also due to #716.

Additionally changes the reading logic to consume pending data even if the
reader has been closed.
@gnodet gnodet merged commit eac455e into jline:master Oct 17, 2021
@Marcono1234 Marcono1234 deleted the PumpReader-surrogate-handling branch October 17, 2021 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants