mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-14 17:24:01 +00:00
ICU-5314 Clean up UTF-16, UTF-32 detectors, UTF-16 test.
X-SVN-Rev: 20035
This commit is contained in:
parent
818fa504fd
commit
c292eb5da0
2 changed files with 4 additions and 2 deletions
|
@ -32,7 +32,7 @@ int32_t CharsetRecog_UTF_16_BE::match(InputText* textIn)
|
|||
{
|
||||
const uint8_t *input = textIn->fRawInput;
|
||||
|
||||
if ((input[0] & 0xFF) == 0xFE && (input[1] & 0xFF) == 0xFF) {
|
||||
if (input[0] == 0xFE && input[1] == 0xFF) {
|
||||
return 100;
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ int32_t CharsetRecog_UTF_32::match(InputText* textIn)
|
|||
bool hasBOM = FALSE;
|
||||
int32_t confidence = 0;
|
||||
|
||||
if (input[0] == 0x00 && input[1] == 0x00 && input[2] == 0xFE && input[3] == 0xFF) {
|
||||
if (getChar(input, 0) == 0x0000FEFFUL) {
|
||||
hasBOM = TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -321,6 +321,7 @@ void CharsetDetectionTest::UTF16Test()
|
|||
|
||||
if (strcmp(name, "UTF-16BE") != 0) {
|
||||
errln("Encoding detection failure for UTF-16BE: got %s", name);
|
||||
goto try_le; // no point in looking at confidence if we got the wrong character set.
|
||||
}
|
||||
|
||||
if (conf != 100) {
|
||||
|
@ -342,6 +343,7 @@ try_le:
|
|||
|
||||
if (strcmp(name, "UTF-16LE") != 0) {
|
||||
errln("Enconding detection failure for UTF-16LE: got %s", name);
|
||||
goto bail; // no point in looking at confidence if we got the wrong character set.
|
||||
}
|
||||
|
||||
if (conf != 100) {
|
||||
|
|
Loading…
Add table
Reference in a new issue