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

Encoding::UndefinedConversionError: UTF-8 to US-ASCII regression #2035

Closed
mkristian opened this issue Oct 9, 2014 · 3 comments
Closed

Encoding::UndefinedConversionError: UTF-8 to US-ASCII regression #2035

mkristian opened this issue Oct 9, 2014 · 3 comments
Assignees
Milestone

Comments

@mkristian
Copy link
Member

the following script t.rb:

# encoding: utf-8
require 'stringio'
s = StringIO.new
s << 'ā'
puts s.string

gives an Encoding::UndefinedConversionError: ""\xC4\x81"" from UTF-8 to US-ASCII error when executed likes this

$ LANG= jruby t.rb
Encoding::UndefinedConversionError: ""\xC4\x81"" from UTF-8 to US-ASCII
   write at org/jruby/ext/stringio/StringIO.java:1140
      << at org/jruby/ext/stringio/StringIO.java:241
  (root) at t.rb:4

version jruby-1.7.8 and before as well as MRI works like this:

$ LANG= ruby t.rb
ā

the same way as

$ LANG=en_US.UTF-8 jruby t.rb
ā

the problem causes problems with jruby/rubygems-servlets#5 since the behaviour of StringIO#<< seems to be platform dependent in the sense it depends on platform encoding. maybe this platform dependency is a feature - have not looked it up.

@rtyler
Copy link

rtyler commented Oct 20, 2014

Does the work-around in maven-tools really mean that this issue is fixed for all JRuby users?

@mkristian mkristian reopened this Oct 20, 2014
@mkristian
Copy link
Member Author

no, only for maven-tools. thanx

@mkristian
Copy link
Member Author

already fixed with jruby-1.7.19 :)

@mkristian mkristian added this to the JRuby 1.7.19 milestone Feb 3, 2015
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

No branches or pull requests

2 participants