author | ihse |
Thu, 14 Nov 2013 11:19:32 +0100 | |
changeset 21805 | c7d7946239de |
parent 5506 | jdk/make/tools/src/build/tools/charsetmapping/EUC_TW.java@202f599c92aa |
child 23010 | 6dadb192ad81 |
permissions | -rw-r--r-- |
5167
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
1 |
/* |
5506 | 2 |
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. |
5167
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
4 |
* |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
5167
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
5167
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
10 |
* |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
15 |
* accompanied this code). |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
16 |
* |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
20 |
* |
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
5167
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
24 |
*/ |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
25 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
26 |
package build.tools.charsetmapping; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
27 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
28 |
import java.io.*; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
29 |
import java.util.ArrayList; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
30 |
import java.util.Scanner; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
31 |
import java.util.Formatter; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
32 |
import java.util.regex.*; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
33 |
import java.nio.charset.*; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
34 |
import static build.tools.charsetmapping.Utils.*; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
35 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
36 |
public class EUC_TW { |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
37 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
38 |
static char[] toCharArray(int[] db, |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
39 |
int b1Min, int b1Max, |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
40 |
int b2Min, int b2Max) |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
41 |
{ |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
42 |
char[] ca = new char[(b1Max - b1Min + 1) * (b2Max - b2Min + 1)]; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
43 |
int off = 0; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
44 |
for (int b1 = b1Min; b1 <= b1Max; b1++) { |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
45 |
for (int b2 = b2Min; b2 <= b2Max; b2++) { |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
46 |
ca[off++] = (char)(db[b1 * 256 + b2] & 0xffff); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
47 |
} |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
48 |
} |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
49 |
return ca; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
50 |
} |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
51 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
52 |
static char[] toCharArray(byte[] ba, |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
53 |
int b1Min, int b1Max, |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
54 |
int b2Min, int b2Max) |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
55 |
{ |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
56 |
char[] ca = new char[(b1Max - b1Min + 1) * (b2Max - b2Min + 1)]; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
57 |
int off = 0; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
58 |
for (int b1 = b1Min; b1 <= b1Max; b1++) { |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
59 |
int b2 = b2Min; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
60 |
while (b2 <= b2Max) { |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
61 |
ca[off++] = (char)(((ba[b1 * 256 + b2++] & 0xff) << 8) | |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
62 |
(ba[b1 * 256 + b2++] & 0xff)); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
63 |
} |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
64 |
} |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
65 |
return ca; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
66 |
} |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
67 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
68 |
private static int initC2BIndex(char[] index) { |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
69 |
int off = 0; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
70 |
for (int i = 0; i < index.length; i++) { |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
71 |
if (index[i] != 0) { |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
72 |
index[i] = (char)off; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
73 |
off += 0x100; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
74 |
} else { |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
75 |
index[i] = UNMAPPABLE_ENCODING; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
76 |
} |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
77 |
} |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
78 |
return off; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
79 |
} |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
80 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
81 |
private static Pattern euctw = Pattern.compile("(?:8ea)?(\\p{XDigit}++)\\s++(\\p{XDigit}++)?\\s*+.*"); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
82 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
83 |
static void genClass(String args[]) throws Exception |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
84 |
{ |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
85 |
InputStream is = new FileInputStream(new File(args[0], "euc_tw.map")); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
86 |
PrintStream ps = new PrintStream(new File(args[1], "EUC_TWMapping.java"), |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
87 |
"ISO-8859-1"); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
88 |
String copyright = getCopyright(new File(args[3])); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
89 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
90 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
91 |
// ranges of byte1 and byte2, something should come from a "config" file |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
92 |
int b1Min = 0xa1; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
93 |
int b1Max = 0xfe; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
94 |
int b2Min = 0xa1; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
95 |
int b2Max = 0xfe; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
96 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
97 |
try { |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
98 |
int[][] db = new int[8][0x10000]; // doublebyte |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
99 |
byte[] suppFlag = new byte[0x10000]; // doublebyte |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
100 |
char[] indexC2B = new char[256]; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
101 |
char[] indexC2BSupp = new char[256]; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
102 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
103 |
for (int i = 0; i < 8; i++) |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
104 |
for (int j = 0; j < 0x10000; j++) |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
105 |
db[i][j] = UNMAPPABLE_DECODING; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
106 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
107 |
Parser p = new Parser(is, euctw); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
108 |
Entry e = null; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
109 |
while ((e = p.next()) != null) { |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
110 |
int plane = 0; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
111 |
if (e.bs >= 0x10000) { |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
112 |
plane = ((e.bs >> 16) & 0xff) - 1; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
113 |
if (plane >= 14) |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
114 |
plane = 7; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
115 |
e.bs = e.bs & 0xffff; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
116 |
} |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
117 |
db[plane][e.bs] = e.cp; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
118 |
if (e.cp < 0x10000) { |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
119 |
indexC2B[e.cp>>8] = 1; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
120 |
} else { |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
121 |
indexC2BSupp[(e.cp&0xffff)>>8] = 1; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
122 |
suppFlag[e.bs] |= (1 << plane); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
123 |
} |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
124 |
} |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
125 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
126 |
StringBuilder sb = new StringBuilder(); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
127 |
Output out = new Output(new Formatter(sb)); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
128 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
129 |
out.format(copyright); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
130 |
out.format("%n// -- This file was mechanically generated: Do not edit! -- //%n"); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
131 |
out.format("package sun.nio.cs.ext;%n%n"); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
132 |
out.format("class EUC_TWMapping {%n%n"); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
133 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
134 |
// boundaries |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
135 |
out.format(" final static int b1Min = 0x%x;%n", b1Min); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
136 |
out.format(" final static int b1Max = 0x%x;%n", b1Max); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
137 |
out.format(" final static int b2Min = 0x%x;%n", b2Min); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
138 |
out.format(" final static int b2Max = 0x%x;%n", b2Max); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
139 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
140 |
// b2c tables |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
141 |
out.format("%n final static String[] b2c = {%n"); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
142 |
for (int plane = 0; plane < 8; plane++) { |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
143 |
out.format(" // Plane %d%n", plane); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
144 |
out.format(toCharArray(db[plane], b1Min, b1Max, b2Min, b2Max), |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
145 |
","); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
146 |
out.format("%n"); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
147 |
} |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
148 |
out.format(" };%n"); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
149 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
150 |
// c2bIndex |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
151 |
out.format("%n static final int C2BSIZE = 0x%x;%n", |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
152 |
initC2BIndex(indexC2B)); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
153 |
out.format("%n static char[] c2bIndex = new char[] {%n"); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
154 |
out.format(indexC2B); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
155 |
out.format(" };%n"); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
156 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
157 |
// c2bIndexSupp |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
158 |
out.format("%n static final int C2BSUPPSIZE = 0x%x;%n", |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
159 |
initC2BIndex(indexC2BSupp)); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
160 |
out.format("%n static char[] c2bSuppIndex = new char[] {%n"); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
161 |
out.format(indexC2BSupp); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
162 |
out.format(" };%n"); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
163 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
164 |
// suppFlags |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
165 |
out.format("%n static String b2cIsSuppStr =%n"); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
166 |
out.format(toCharArray(suppFlag, b1Min, b1Max, b2Min, b2Max), |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
167 |
";"); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
168 |
out.format("}"); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
169 |
out.close(); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
170 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
171 |
ps.println(sb.toString()); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
172 |
ps.close(); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
173 |
} catch (Exception x) { |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
174 |
x.printStackTrace(); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
175 |
} |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
176 |
} |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
177 |
} |