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

Breaking Change in v3.0.9 #78

Open
jherdman opened this issue Jan 15, 2024 · 2 comments · May be fixed by #80
Open

Breaking Change in v3.0.9 #78

jherdman opened this issue Jan 15, 2024 · 2 comments · May be fixed by #80

Comments

@jherdman
Copy link

I've traced back a breaking change to v3.0.9. Here's the minimal repro:

str = "\xFE\xFFColumn1,Column2\n" + "\"value1.1\",value1.2\n"
io = StringIO.new(str)
io.gets *["\n", 8192]

In v3.0.8:

io.gets *["\n", 8192]
#=>  "\xFE\xFFColumn1,Column2\n"

In v3.0.9:

     ArgumentError:
       encoding mismatch: UTF-16BE IO with UTF-8 RS

I suspect there's some kind of action for me, but this error message is a bit opaque (i.e. what is RS?).

@kou
Copy link
Member

kou commented Jan 16, 2024

I couldn't reproduce this.

Did you really use the script? (The script doesn't have require "stringio".)

@jherdman
Copy link
Author

Ah ha! I missed a few things. Here's the revised script:

require 'stringio'

str = "\xFE\xFFColumn1,Column2\n" + "\"value1.1\",value1.2\n"
io = StringIO.new(str)
io.set_encoding_by_bom
io.gets *["\n", 8192]

nobu added a commit to nobu/stringio that referenced this issue Jan 16, 2024
@nobu nobu linked a pull request Jan 16, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants