You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix encoding fallback error handling and error message formatting
- Raise ArgumentError("too big fallback string") when a fallback
function returns a value that cannot be encoded to the destination
encoding. Previously, the invalid character was silently dropped.
- Format UTF-8 codepoints as U+XXXX in UndefinedConversionError messages
instead of showing the raw byte dump (e.g., "U+FFFD" instead of
"\xEF\xBF\xBD"), matching MRI behavior.
These changes fix all 12 failing specs in encode_spec.rb related to
fallback option error handling.
if (Arrays.equals(errSource, ec.source) && Arrays.equals(ec.lastError.getDestination(), ec.destination)) {
1703
-
mesg.append(dumped).append(" from ").append( newString(errSource) ).append(" to ").append( newString(ec.lastError.getDestination()) );
1714
+
mesg.append(charRepresentation).append(" from ").append( newString(errSource) ).append(" to ").append( newString(ec.lastError.getDestination()) );
1704
1715
} else {
1705
-
mesg.append(dumped).append(" to ").append( newString(ec.lastError.getDestination()) ).append(" in conversion from ").append( newString(ec.source) );
1716
+
mesg.append(charRepresentation).append(" to ").append( newString(ec.lastError.getDestination()) ).append(" in conversion from ").append( newString(ec.source) );
1706
1717
for (inti = 0; i < ec.numTranscoders; i++) {
1707
1718
mesg.append(" to ").append( newString(ec.elements[i].transcoding.transcoder.getDestination()) );
0 commit comments