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

Fix File.read with UTF-16LE #2605

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
2 participants
@lumeet
Copy link
Contributor

lumeet commented Feb 17, 2015

File.open("a.txt", "w+") do |f|
  f.write "\xFF\xFE"
  f.close
end
File.read("a.txt", mode: "rb:bom|utf-8")

...results in...

<java.lang.ClassCastException: org.jruby.RubyNil cannot be cast to org.jruby.RubyFixnum>

A check for a null value seems to be missing after the BOM.

The test_truncate_wbuf removal is just general cleanup. It doesn't have anything to do with the fix. I guess it's ok. :)

Fix File.read with UTF-16LE
A null value after the BOM no longer causes an error.

@enebo enebo added this to the JRuby 9.0.0.0.rc1 milestone May 1, 2015

@enebo enebo added the core label May 1, 2015

@enebo

This comment has been minimized.

Copy link
Member

enebo commented May 1, 2015

@lumeet Sorry for leaving this so long but it no longer applies cleanly. Can you update this PR?

@lumeet

This comment has been minimized.

Copy link
Contributor Author

lumeet commented May 1, 2015

@enebo I'm closing this. The bug is fixed by another commit and test/mri/excludes/TestFile.rb looks the same on master, too.

@lumeet lumeet closed this May 1, 2015

@lumeet lumeet deleted the lumeet:file_bom_16le branch May 1, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.