Bernerd Schaefer created JRUBY-6588:
---------------------------------------

             Summary: String#encode should not convert binary to mangled UTF-8
                 Key: JRUBY-6588
                 URL: https://jira.codehaus.org/browse/JRUBY-6588
             Project: JRuby
          Issue Type: Bug
    Affects Versions: JRuby 1.6.7
            Reporter: Bernerd Schaefer
            Assignee: Thomas E Enebo


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

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
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