Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.6.7
-
Fix Version/s: JRuby 1.7.0.pre1
-
Component/s: None
-
Labels:None
-
Testcase included:yes
-
Number of attachments :
Description
In Moped (my MongoDB driver), I have some code attempting to safely convert input text into UTF-8 (which all strings must be).
See for a simplified test-case of the implementation: https://gist.github.com/2351047
Problem: that calling encode('utf-8') on a binary string creates garbage utf-8 text instead of raising a conversion error like 1.9.
Reason the code exists: We're tracking referrers in our app, but the header value in the rack environment is encoded as ASCII-8bit; this code then follows the happy-path of calling `encode('utf-8')` and finally tries forcing the encoding when that raises an error.
Tested on: jruby-1.6.7 and jruby-1.7.0-dev