Issue Type: Bug Bug
Affects Versions: JRuby 1.7.4
Assignee: Unassigned
Components: Encoding
Created: 22/Jul/13 5:19 AM
Description:

MRI documentation says

The default replacement string is “uFFFD” for Unicode encoding forms, and “?” otherwise.

Experiments make clear that "uFFFD" really means "\uFFFD".

In JRuby, it doesn't seem to matter if you give encode a replacement character or not; all of the below trigger Java::JavaLang::IllegalArgumentException: Illegal replacement.

# Nothing to replace
"".encode("utf-16", invalid: :replace)
"".encode("utf-16", undef: :replace)
# Not encode-able without replacement
"\xfe".encode("utf-16", undef: :replace)
"\xfe".encode("utf-16", invalid: :replace)
Environment: jruby 1.7.4 (1.9.3p392) 2013-05-16 2390d3b on Java HotSpot(TM) 64-Bit Server VM 1.6.0_45-b06 [linux-amd64]
Project: JRuby
Priority: Major Major
Reporter: James Lee
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