KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > saxon > charcode > CP852CharacterSet


1 package net.sf.saxon.charcode;
2
3 /**
4 This package defines pluggable character set CP852
5 */

6
7 public class CP852CharacterSet implements PluggableCharacterSet {
8
9     public static CP852CharacterSet theInstance = null;
10
11     private CP852CharacterSet() {}
12
13     public static CP852CharacterSet getInstance() {
14         if (theInstance == null) {
15             init();
16             theInstance = new CP852CharacterSet();
17         }
18         return theInstance;
19     }
20
21     private static boolean c[] = null;
22
23     private static void init () {
24         c = new boolean[400];
25         for (int i=0; i<127; i++) {
26             c[i] = true;
27         }
28         for (int i=127; i<400; i++) {
29             c[i] = false;
30     }
31
32     c[167] = true;
33     c[171] = true;
34     c[172] = true;
35     c[187] = true;
36     c[193] = true;
37     c[194] = true;
38     c[196] = true;
39     c[199] = true;
40     c[201] = true;
41     c[203] = true;
42     c[205] = true;
43     c[206] = true;
44     c[211] = true;
45     c[212] = true;
46     c[214] = true;
47     c[218] = true;
48     c[220] = true;
49     c[221] = true;
50     c[223] = true;
51     c[225] = true;
52     c[226] = true;
53     c[228] = true;
54     c[231] = true;
55     c[233] = true;
56     c[235] = true;
57     c[237] = true;
58     c[238] = true;
59     c[243] = true;
60     c[244] = true;
61     c[246] = true;
62     c[250] = true;
63     c[252] = true;
64     c[253] = true;
65     c[258] = true;
66     c[259] = true;
67     c[260] = true;
68     c[261] = true;
69     c[262] = true;
70     c[263] = true;
71     c[268] = true;
72     c[269] = true;
73     c[270] = true;
74     c[271] = true;
75     c[272] = true;
76     c[273] = true;
77     c[280] = true;
78     c[281] = true;
79     c[282] = true;
80     c[283] = true;
81     c[313] = true;
82     c[314] = true;
83     c[317] = true;
84     c[318] = true;
85     c[321] = true;
86     c[322] = true;
87     c[323] = true;
88     c[324] = true;
89     c[327] = true;
90     c[328] = true;
91     c[336] = true;
92     c[337] = true;
93     c[340] = true;
94     c[341] = true;
95     c[344] = true;
96     c[345] = true;
97     c[346] = true;
98     c[347] = true;
99     c[350] = true;
100     c[351] = true;
101     c[352] = true;
102     c[353] = true;
103     c[355] = true;
104     c[356] = true;
105     c[357] = true;
106     c[366] = true;
107     c[367] = true;
108     c[368] = true;
109     c[369] = true;
110     c[377] = true;
111     c[378] = true;
112     c[379] = true;
113     c[380] = true;
114     c[381] = true;
115     c[382] = true;
116 }
117
118     public final boolean inCharset(int ch) {
119         return ch < 400 && c[ch];
120     }
121
122     public final String JavaDoc getEncodingName() {
123         return "cp852";
124     }
125 }
126
127 /*
128 (C) Z. Wagner -- Ice Bear Soft, 11 Oct 2001
129 http://icebearsoft.euweb.cz
130
131 This package is free software. Its use and distribution should follow
132 the Library General Public Licence (see http://www.gnu.org). Since this licence
133 is void in the Czech Republic, the users may opt to use a modified version
134 available from http://www.zastudena.cz
135
136 The character mapping was obtained by conversion a character table of all non-US characters from
137 CP852 into UNICODE entities using a simple stylesheet and saxon with the following attribute in
138 xsl:output
139
140 saxon:character-representation="dec;dec"
141
142 The class was tested by reverse conversion of the generated table to native representation as well
143 as by transformation of several texts which use Czech and Slovak accented characters.
144 */

145
Popular Tags