Commit aefcd057 authored by Neil Fuller's avatar Neil Fuller
Browse files

Ensure consistency around ignorable codepoints

Since Android updated to ICU54 (Android 6.0), Android's
CharsetEncoder would report canEncode() based on whether or
not the input sequence would map to no bytes. This meant the
behavior for "default ignorable codepoints" was inconsistent.

If a CharBuffer only contained ignorable codepoints with no
mapping it would report false, but true if they were part of
a wider string.

This change makes the behavior consistent: all default ignorable
codepoints will now register canEncode() == true whether alone
or as part of a sequence. canEncode() effectively becomes
"If this sequence were encoded, would there be a mapping error?".

This change contains a new test and a set of reference data
for the new behavior for StandardCharsets. The reference data
is generated from the new encoder behavior. See
StandardCharsetsEncoderTest.Dumper for how the files were
generated.

Bug: 73550237
Test: CTS: run cts -m CtsLibcoreTestCases

Merged-In: Id78a3259940e73c83f895a4d95e7c526176b06a6
Change-Id: Id78a3259940e73c83f895a4d95e7c526176b06a6
(cherry picked from commit 4e97e614)
parent 9be5324b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment