Issue Type: Bug Bug
Affects Versions: JRuby 1.7.0
Assignee: Unassigned
Components: Encoding
Created: 25/Nov/12 10:08 PM
Description:

$ rvm use ruby-head
Using /Users/user/.rvm/gems/ruby-head
$ ruby -e 'x="\xB0\xB1"; x.force_encoding("binary"); puts x.encode(:invalid => :replace, :replace => "?")'
??
String#encode with :invalid / replacements still raises an encoding error for binary to UTF-8 conversion. This is inconsistent with MRI's behavior, which is able to properly encode the invalid characters using the replacement values:

$ rvm use 1.9.3
Using /Users/user/.rvm/gems/ruby-1.9.3-p327
$ ruby -e 'x="\xB0\xB1"; x.force_encoding("binary"); puts x.encode(:invalid => :replace, :replace => "?")'
??

$ rvm use jruby
Using /Users/user/.rvm/gems/jruby-1.7.0
$ ruby -e 'x="\xB0\xB1"; x.force_encoding("binary"); puts x.encode(:invalid => :replace, :replace => "?")'
Encoding::UndefinedConversionError: "\xB0" from ASCII-8BIT to UTF-8
encode at org/jruby/RubyString.java:7508

Environment: (Tested on) Mac OS X 10.7
Project: JRuby
Priority: Major Major
Reporter: Loren Segal
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

Reply via email to