Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.7.0.pre1
-
Fix Version/s: JRuby 1.7.0.pre2
-
Component/s: None
-
Labels:None
-
Testcase included:yes
-
Patch Submitted:Yes
-
Number of attachments :
Description
There are two pull requests that address this issue:
https://github.com/jruby/jruby/pull/223 (fix for the issue)
https://github.com/rubyspec/rubyspec/pull/146 (add the spec to rubyspec)
just to make it convenient, here's the failing test case, that demonstrate the issue:
it "an ascii substring of a binary string should be encoded UTF-8 without raising an exception" do
binary_string = "\x82foo"
ascii_string = binary_string.bytes.to_a.pack('c*')[1..-1]
ascii_string.should == "foo"
ascii_string.encoding.name.should == "ASCII-8BIT"
utf8_string = ascii_string.encode("UTF-8")
utf8_string.should == "foo"
utf8_string.encoding.name.should == "UTF-8"
end
Tom Enebo already applied the fix, so I'm resolving this.
John: It might be best if you reformulated your test case as a test/unit test and submitted it to MRI; RubySpec has not been very responsive to pull requests recently, and we run MRI tests as well. Thanks for the fix!