Author: atsushi
Date: 2005-04-24 22:42:10 -0400 (Sun, 24 Apr 2005)
New Revision: 43524

Modified:
   trunk/mcs/class/I18N/CJK/CP51932.cs
   trunk/mcs/class/I18N/CJK/CP932.cs
Log:
2005-04-25  Atsushi Enomotot  <[EMAIL PROTECTED]>

        * CP932.cs : Half-width katakana was not handled properly.
        * CP51932.cs : ditto. Patch by Hiroyuki Ishimine.



Modified: trunk/mcs/class/I18N/CJK/CP51932.cs
===================================================================
--- trunk/mcs/class/I18N/CJK/CP51932.cs 2005-04-25 02:32:00 UTC (rev 43523)
+++ trunk/mcs/class/I18N/CJK/CP51932.cs 2005-04-25 02:42:10 UTC (rev 43524)
@@ -275,6 +275,8 @@
                                } else if (byteval >= 0xA1 && byteval <= 0xFE) {
                                        // First byte in a double-byte sequence.
                                        last = byteval;
+                               } else if (byteval == 0x87) {
+                                       // First byte in half-width katakana
                                } else {
                                        // Invalid first byte. Let '?'
                                        ++length;
@@ -353,6 +355,9 @@
                                } else if (byteval <= 0x7F) {
                                        // Ordinary ASCII/Latin1/Control 
character.
                                        chars [posn++] = (char) byteval;
+                               } else if (byteval == 0x8E) {
+                                       // First byte of half-width Katakana
+                                       last = byteval;
                                } else if (byteval >= 0xA1 && byteval <= 0xFE) {
                                        // First byte in a double-byte sequence.
                                        last = byteval;
@@ -361,6 +366,17 @@
                                        chars [posn++] = '?';
                                }
                        }
+                       else if (last == 0x8E) {
+                               if (byteval >= 0xA1 && byteval <= 0xDF) {
+                                       value = ((byteval - 0x40) |
+                                               (last + 0x71) << 8);
+                                       chars [posn++] = (char) value;
+                               } else {
+                                       // Invalid second byte.
+                                       chars [posn++] = '?';
+                               }
+                               last =0;
+                       }
                        else if (last == 0x8F) {
                                // 3-byte character
                                // FIXME: currently not supported yet

Modified: trunk/mcs/class/I18N/CJK/CP932.cs
===================================================================
--- trunk/mcs/class/I18N/CJK/CP932.cs   2005-04-25 02:32:00 UTC (rev 43523)
+++ trunk/mcs/class/I18N/CJK/CP932.cs   2005-04-25 02:42:10 UTC (rev 43524)
@@ -286,14 +286,14 @@
                                                value = 
((int)(cjkToJis[value])) |
                                                                
(((int)(cjkToJis[value + 1])) << 8);
                                        }
-                                       else if(ch >= 0xFF01 && ch <= 0xFFEF)
+                                       else if(ch >= 0xFF01 && ch <= 0xFF60)
                                        {
-                                               // This range contains extra 
characters,
-                                               // including half-width 
katakana.
-                                               value = (ch - 0xFF01) * 2;
-                                               value = 
((int)(extraToJis[value])) |
-                                                               
(((int)(extraToJis[value + 1])) << 8);
+                                               value = ch - 0xFF00 + 0x20;
                                        }
+                                       else if(ch >= 0xFF60 && ch <= 0xFFA0)
+                                       {
+                                               value = ch - 0xFF60 + 0xA0;
+                                       }
                                        else
                                        {
                                                // Invalid character.

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to