icu/patches/source_common_ucnv2022.c.patch
author yukie
Wed, 24 Mar 2010 17:01:56 +0900
changeset 12 ec51c44224ba
child 48 7554778c8d9f
permissions -rw-r--r--
Add icu

--- icu/source/common/ucnv2022.c.orig	2009-05-22 15:45:08.437653452 +0800
+++ icu/source/common/ucnv2022.c	2009-05-22 15:46:31.620400264 +0800
@@ -166,7 +166,12 @@
  * - ICU does not distinguish between different versions of JIS X 0208.
  */
 static const uint16_t jpCharsetMasks[5]={
+    /*
+     * Sun modification:
+     * We support JISX212 at ISO-2022-JP too.
     CSM(ASCII)|CSM(JISX201)|CSM(JISX208)|CSM(HWKANA_7BIT),
+     */
+    CSM(ASCII)|CSM(JISX201)|CSM(JISX208)|CSM(HWKANA_7BIT)|CSM(JISX212),
     CSM(ASCII)|CSM(JISX201)|CSM(JISX208)|CSM(HWKANA_7BIT)|CSM(JISX212),
     CSM(ASCII)|CSM(JISX201)|CSM(JISX208)|CSM(HWKANA_7BIT)|CSM(JISX212)|CSM(GB2312)|CSM(KSC5601)|CSM(ISO8859_1)|CSM(ISO8859_7),
     CSM(ASCII)|CSM(JISX201)|CSM(JISX208)|CSM(HWKANA_7BIT)|CSM(JISX212)|CSM(GB2312)|CSM(KSC5601)|CSM(ISO8859_1)|CSM(ISO8859_7),
@@ -1371,7 +1376,12 @@
     "\x1B\x24\x42",         /* <ESC>$B  JISX-208    */
     "\x1B\x24\x28\x44",     /* <ESC>$(D JISX-212    */
     "\x1B\x24\x41",         /* <ESC>$A  GB2312      */
-    "\x1B\x24\x28\x43",     /* <ESC>$(C KSC5601     */
+    /*
+     * Sun modification: 4936244
+     * RFC1557 defines the designator as ESC "$" ")" "C".
+    "\x1B\x24\x28\x43",        <ESC>$(C KSC5601     *
+     */
+    "\x1B\x24\x29\x43",     /* <ESC>$)C KSC5601     */
     "\x1B\x28\x49"          /* <ESC>(I  HWKANA_7BIT */
 
 };
@@ -1675,7 +1685,10 @@
                     choices[choiceCount++] = (int8_t)HWKANA_7BIT;
                 }
                 /* Do not try single-byte half-width Katakana for other versions. */
+                /* Sun modification: we need support it */
+                /*
                 csm &= ~CSM(HWKANA_7BIT);
+                */
 
                 /* try the current G0 charset */
                 choices[choiceCount++] = cs = pFromU2022State->cs[0];
@@ -1757,6 +1770,11 @@
                             g = 0;
                         }
                         /* else do not use HWKANA_7BIT with other versions */
+                        else { /* Sun modification: we need to support it */
+                            targetValue = (uint32_t)(sourceChar - (HWKANA_START - 0x21));
+                            len = 1;
+                            cs = cs0;
+                        }
                     }
                     break;
                 case JISX201:
@@ -2060,18 +2078,22 @@
                 mySource--;
 escape:
                 {
+                    /* SUN modification
                     const char * mySourceBefore = mySource;
                     int8_t toULengthBefore = args->converter->toULength;
+                    */
 
                     changeState_2022(args->converter,&(mySource),
                         mySourceLimit, ISO_2022_JP,err);
 
                     /* If in ISO-2022-JP only and we successully completed an escape sequence, but previous segment was empty, create an error */
+                    /*SUN modificatio
                     if(myData->version==0 && myData->key==0 && U_SUCCESS(*err) && myData->isEmptySegment) {
                         *err = U_ILLEGAL_ESCAPE_SEQUENCE;
                         args->converter->toUCallbackReason = UCNV_IRREGULAR;
                         args->converter->toULength = toULengthBefore + (mySource - mySourceBefore);
                     }
+                    */
                 }
 
                 /* invalid or illegal escape sequence */
@@ -3713,7 +3735,10 @@
     UCNV_IBM,
     UCNV_ISO_2022,
     1,
-    3, /* max 3 bytes per UChar from UTF-8 (4 bytes from surrogate _pair_) */
+    /*
+     * Sun modification: 4936232
+    3, */ /* max 3 bytes per UChar from UTF-8 (4 bytes from surrogate _pair_) */
+    9,
     { 0x1a, 0, 0, 0 },
     1,
     FALSE,
@@ -3763,7 +3788,10 @@
     UCNV_IBM,
     UCNV_ISO_2022,
     1,
-    6, /* max 6 bytes per UChar: 4-byte escape sequence + DBCS */
+    /*
+     * Sun modification: 4936232
+    6, */ /* max 6 bytes per UChar: 4-byte escape sequence + DBCS */
+    9,
     { 0x1a, 0, 0, 0 },
     1,
     FALSE,
@@ -3813,7 +3841,10 @@
     UCNV_IBM,
     UCNV_ISO_2022,
     1,
-    3, /* max 3 bytes per UChar: SO+DBCS */
+    /*
+     * Sun modification: 4936232
+    3, */ /* max 3 bytes per UChar: SO+DBCS */
+    8,
     { 0x1a, 0, 0, 0 },
     1,
     FALSE,