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

Flush CharsetDecoder to produce final chunk #2667

Merged
merged 2 commits into from
Oct 6, 2021

Conversation

rossabaker
Copy link
Member

@rossabaker rossabaker commented Oct 5, 2021

Only necessary in a handful of non-UTF-8 charsets. Setting the last input flag on the final decode isn't sufficient: the decoder state must be flushed in a separate call.

Fixes #2664.

decoder.flush(out) match {
case res if res.isUnderflow =>
if (out.position() > 0) {
out.flip()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need a (out: Buffer).flip() here to maintain JDK8 support.

@mpilquist mpilquist merged commit e345809 into typelevel:main Oct 6, 2021
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.

decodeWithCharset doesn't flush
2 participants