make/tools/src/build/tools/charsetmapping/DBCS.java

Print this page

        

@@ -192,10 +192,19 @@
         PrintStream ops = new PrintStream(new FileOutputStream(
                              new File(dstDir, clzName + ".java")));
         if (hisName == null)
             hisName = "";
 
+        // (5) c2b replacement, only used for JIs0208/0212, which
+        // are two pure db charsets so default '3f' does not work
+        String c2bRepl = "";
+        if (clzName.startsWith("JIS_X_0208")) {
+            c2bRepl = "new byte[]{ (byte)0x21, (byte)0x29 },";
+        } else if (clzName.startsWith("JIS_X_0212")) {
+            c2bRepl = "new byte[]{ (byte)0x22, (byte)0x44 },";
+        }
+
         while (s.hasNextLine()) {
             String line = s.nextLine();
             if (line.indexOf("$") == -1) {
                 ops.println(line);
                 continue;

@@ -225,11 +234,12 @@
                        .replace("$B2MIN$"   , "0x" + Integer.toString(b2Min, 16))
                        .replace("$B2MAX$"   , "0x" + Integer.toString(b2Max, 16))
                        .replace("$B2C$", b2c)
                        .replace("$C2BLENGTH$", "0x" + Integer.toString(c2bOff, 16))
                        .replace("$NONROUNDTRIP_B2C$", b2cNR)
-                       .replace("$NONROUNDTRIP_C2B$", c2bNR);
+                       .replace("$NONROUNDTRIP_C2B$", c2bNR)
+                       .replace("$ENC_REPLACEMENT$", c2bRepl);
 
             ops.println(line);
         }
         ops.close();
     }