From 04b5b5499801c35a585d91905650b05ebf1f43fd Mon Sep 17 00:00:00 2001 From: Michael Ow Date: Wed, 23 Sep 2015 20:49:25 +0000 Subject: [PATCH] ICU-11869 Update 2022 code in ICU4C X-SVN-Rev: 38014 --- icu4c/source/common/ucnv2022.cpp | 40 ++++------------------- icu4c/source/test/testdata/conversion.txt | 4 +-- 2 files changed, 9 insertions(+), 35 deletions(-) diff --git a/icu4c/source/common/ucnv2022.cpp b/icu4c/source/common/ucnv2022.cpp index c27e6226e24..0c12dd0d7ba 100644 --- a/icu4c/source/common/ucnv2022.cpp +++ b/icu4c/source/common/ucnv2022.cpp @@ -1418,19 +1418,6 @@ toUnicodeCallback(UConverter *cnv, /* preference order of JP charsets */ static const StateEnum jpCharsetPref[]={ - ASCII, - JISX201, - ISO8859_1, - ISO8859_7, - JISX208, - JISX212, - GB2312, - KSC5601, - HWKANA_7BIT -}; - -/* alternate preference order of JP charsets for version 2,3,4*/ -static const StateEnum jpCharsetPref_alt[]={ ASCII, JISX201, ISO8859_1, @@ -1769,26 +1756,13 @@ getTrail: choices[choiceCount++] = cs; csm &= ~CSM(cs); } - - /* - * version 2,3,4 of JP iso 2022 requires a different preference order for the possible charsets is there is no previous state set - */ - if (cs == 0 && converterData->version >= 2) { - for(i = 0; i < UPRV_LENGTHOF(jpCharsetPref_alt); ++i) { - cs = (int8_t)jpCharsetPref_alt[i]; - if(CSM(cs) & csm) { - choices[choiceCount++] = cs; - csm &= ~CSM(cs); - } - } - } else { - /* try all the other possible charsets */ - for(i = 0; i < UPRV_LENGTHOF(jpCharsetPref); ++i) { - cs = (int8_t)jpCharsetPref[i]; - if(CSM(cs) & csm) { - choices[choiceCount++] = cs; - csm &= ~CSM(cs); - } + + /* try all the other possible charsets */ + for(i = 0; i < UPRV_LENGTHOF(jpCharsetPref); ++i) { + cs = (int8_t)jpCharsetPref[i]; + if(CSM(cs) & csm) { + choices[choiceCount++] = cs; + csm &= ~CSM(cs); } } } diff --git a/icu4c/source/test/testdata/conversion.txt b/icu4c/source/test/testdata/conversion.txt index f3183bca62b..0e3c8f4724b 100644 --- a/icu4c/source/test/testdata/conversion.txt +++ b/icu4c/source/test/testdata/conversion.txt @@ -1262,8 +1262,8 @@ conversion:table(nofallback) { { "ISO-2022-JP-2", "?@A\u00e4\u03b1\u203EB", - :bin{ 3f40411B2E411B4E641B2E461B4E611B284A7E421B2842 }, - :intvector{ 0,1,2,3,3,3,3,3,3,4,4,4,4,4,4,5,5,5,5,6,6,6,6 }, + :bin{ 3f40411B2E411B4E641b244226411b284a7e421b2842 }, + :intvector{ 0,1,2,3,3,3,3,3,3,4,4,4,4,4,5,5,5,5,6,6,6,6 }, :int{1}, :int{1}, "", "?", "" } -- 2.40.0