From e337ab867882d00e9bd2e48c47149d1f97f1245f Mon Sep 17 00:00:00 2001 From: Michael Ow Date: Wed, 4 Jun 2008 17:49:37 +0000 Subject: [PATCH] ICU-6300 Set the max bytes per char for UTF16 to 4 to make it consistent with the specs. X-SVN-Rev: 24105 --- icu4c/source/common/ucnv_u16.c | 8 ++++---- icu4c/source/test/cintltst/ccapitst.c | 4 ++-- icu4j/src/com/ibm/icu/charset/CharsetUTF16.java | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/icu4c/source/common/ucnv_u16.c b/icu4c/source/common/ucnv_u16.c index 6fc9e2a4493..ff96e3b0cfd 100644 --- a/icu4c/source/common/ucnv_u16.c +++ b/icu4c/source/common/ucnv_u16.c @@ -1,6 +1,6 @@ /* ********************************************************************** -* Copyright (C) 2002-2006, International Business Machines +* Copyright (C) 2002-2008, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * file name: ucnv_u16.c @@ -574,7 +574,7 @@ static const UConverterImpl _UTF16BEImpl={ static const UConverterStaticData _UTF16BEStaticData={ sizeof(UConverterStaticData), "UTF-16BE", - 1200, UCNV_IBM, UCNV_UTF16_BigEndian, 2, 2, + 1200, UCNV_IBM, UCNV_UTF16_BigEndian, 2, 4, { 0xff, 0xfd, 0, 0 },2,FALSE,FALSE, 0, 0, @@ -1129,7 +1129,7 @@ static const UConverterImpl _UTF16LEImpl={ static const UConverterStaticData _UTF16LEStaticData={ sizeof(UConverterStaticData), "UTF-16LE", - 1202, UCNV_IBM, UCNV_UTF16_LittleEndian, 2, 2, + 1202, UCNV_IBM, UCNV_UTF16_LittleEndian, 2, 4, { 0xfd, 0xff, 0, 0 },2,FALSE,FALSE, 0, 0, @@ -1351,7 +1351,7 @@ static const UConverterStaticData _UTF16StaticData = { sizeof(UConverterStaticData), "UTF-16", 1204, /* CCSID for BOM sensitive UTF-16 */ - UCNV_IBM, UCNV_UTF16, 2, 2, + UCNV_IBM, UCNV_UTF16, 2, 4, #if U_IS_BIG_ENDIAN { 0xff, 0xfd, 0, 0 }, 2, #else diff --git a/icu4c/source/test/cintltst/ccapitst.c b/icu4c/source/test/cintltst/ccapitst.c index b6008f94733..18accc4533a 100644 --- a/icu4c/source/test/cintltst/ccapitst.c +++ b/icu4c/source/test/cintltst/ccapitst.c @@ -2808,8 +2808,8 @@ static void TestLMBCSMaxChar(void) { { 1, "US-ASCII"}, { 1, "ISO-8859-1"}, - { 2, "UTF-16"}, - { 2, "UTF-16BE"}, + { 4, "UTF-16"}, + { 4, "UTF-16BE"}, { 3, "UTF-8"}, { 3, "CESU-8"}, { 3, "SCSU"}, diff --git a/icu4j/src/com/ibm/icu/charset/CharsetUTF16.java b/icu4j/src/com/ibm/icu/charset/CharsetUTF16.java index 959c5b55e34..43c13ce9b3a 100644 --- a/icu4j/src/com/ibm/icu/charset/CharsetUTF16.java +++ b/icu4j/src/com/ibm/icu/charset/CharsetUTF16.java @@ -52,7 +52,7 @@ class CharsetUTF16 extends CharsetICU { this.endianXOR = ENDIAN_XOR_LE; } - maxBytesPerChar = 2; + maxBytesPerChar = 4; minBytesPerChar = 2; maxCharsPerByte = 1; }