]> granicus.if.org Git - icu/commitdiff
ICU-11869 Add fix to JIS8 and other ISO2022JP
authorMichael Ow <mow@svn.icu-project.org>
Wed, 23 Sep 2015 05:22:40 +0000 (05:22 +0000)
committerMichael Ow <mow@svn.icu-project.org>
Wed, 23 Sep 2015 05:22:40 +0000 (05:22 +0000)
X-SVN-Rev: 38002

icu4c/source/common/ucnv2022.cpp

index e169d89df61127fd7aba9ac173ecdc2f8ab609e9..c27e6226e244ca0edf20e033d2a3987248682cd6 100644 (file)
@@ -1429,8 +1429,8 @@ static const StateEnum jpCharsetPref[]={
     HWKANA_7BIT
 };
 
-/* preference order of JP charsets for version 4*/
-static const StateEnum jpCharsetPref_ver4[]={
+/* alternate preference order of JP charsets for version 2,3,4*/
+static const StateEnum jpCharsetPref_alt[]={
     ASCII,
     JISX201,
     ISO8859_1,
@@ -1771,11 +1771,11 @@ getTrail:
                 }
                 
                 /*
-                 * version 4 of JP iso 2022 requires a different preference order for the possible charsets.
+                 * 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 (converterData->version == 4) {
-                    for(i = 0; i < UPRV_LENGTHOF(jpCharsetPref_ver4); ++i) {
-                        cs = (int8_t)jpCharsetPref_ver4[i];
+                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);