root / src / gr / ebs / gss / server / webdav / MIME2Java.java @ a17a48ae
History | View | Annotate | Download (17.8 kB)
1 | 14ad7326 | pastith | /*
|
---|---|---|---|
2 | 14ad7326 | pastith | * Licensed to the Apache Software Foundation (ASF) under one or more
|
3 | 14ad7326 | pastith | * contributor license agreements. See the NOTICE file distributed with
|
4 | 14ad7326 | pastith | * this work for additional information regarding copyright ownership.
|
5 | 14ad7326 | pastith | * The ASF licenses this file to You under the Apache License, Version 2.0
|
6 | 14ad7326 | pastith | * (the "License"); you may not use this file except in compliance with
|
7 | 14ad7326 | pastith | * the License. You may obtain a copy of the License at
|
8 | 14ad7326 | pastith | *
|
9 | 14ad7326 | pastith | * http://www.apache.org/licenses/LICENSE-2.0
|
10 | 14ad7326 | pastith | *
|
11 | 14ad7326 | pastith | * Unless required by applicable law or agreed to in writing, software
|
12 | 14ad7326 | pastith | * distributed under the License is distributed on an "AS IS" BASIS,
|
13 | 14ad7326 | pastith | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 | 14ad7326 | pastith | * See the License for the specific language governing permissions and
|
15 | 14ad7326 | pastith | * limitations under the License.
|
16 | 14ad7326 | pastith | */
|
17 | 14ad7326 | pastith | |
18 | 14ad7326 | pastith | package gr.ebs.gss.server.webdav; |
19 | 14ad7326 | pastith | |
20 | 14ad7326 | pastith | import java.util.Hashtable; |
21 | 14ad7326 | pastith | |
22 | 14ad7326 | pastith | /**
|
23 | 14ad7326 | pastith | * MIME2Java is a convenience class which handles conversions between MIME charset names
|
24 | 14ad7326 | pastith | * and Java encoding names.
|
25 | 14ad7326 | pastith | * <p>The supported XML encodings are the intersection of XML-supported code sets and those
|
26 | 14ad7326 | pastith | * supported in JDK 1.1.
|
27 | 14ad7326 | pastith | * <p>MIME charset names are used on <var>xmlEncoding</var> parameters to methods such
|
28 | 14ad7326 | pastith | * as <code>TXDocument#setEncoding</code> and <code>DTD#setEncoding</code>.
|
29 | 14ad7326 | pastith | * <p>Java encoding names are used on <var>encoding</var> parameters to
|
30 | 14ad7326 | pastith | * methods such as <code>TXDocument#printWithFormat</code> and <code>DTD#printExternal</code>.
|
31 | 14ad7326 | pastith | * <P>
|
32 | 14ad7326 | pastith | * <TABLE BORDER="0" WIDTH="100%">
|
33 | 14ad7326 | pastith | * <TR>
|
34 | 14ad7326 | pastith | * <TD WIDTH="33%">
|
35 | 14ad7326 | pastith | * <P ALIGN="CENTER"><B>Common Name</B>
|
36 | 14ad7326 | pastith | * </TD>
|
37 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
38 | 14ad7326 | pastith | * <P ALIGN="CENTER"><B>Use this name in XML files</B>
|
39 | 14ad7326 | pastith | * </TD>
|
40 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
41 | 14ad7326 | pastith | * <P ALIGN="CENTER"><B>Name Type</B>
|
42 | 14ad7326 | pastith | * </TD>
|
43 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
44 | 14ad7326 | pastith | * <P ALIGN="CENTER"><B>Xerces converts to this Java Encoder Name</B>
|
45 | 14ad7326 | pastith | * </TD>
|
46 | 14ad7326 | pastith | * </TR>
|
47 | 14ad7326 | pastith | * <TR>
|
48 | 14ad7326 | pastith | * <TD WIDTH="33%">8 bit Unicode</TD>
|
49 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
50 | 14ad7326 | pastith | * <P ALIGN="CENTER">UTF-8
|
51 | 14ad7326 | pastith | * </TD>
|
52 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
53 | 14ad7326 | pastith | * <P ALIGN="CENTER">IANA
|
54 | 14ad7326 | pastith | * </TD>
|
55 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
56 | 14ad7326 | pastith | * <P ALIGN="CENTER">UTF8
|
57 | 14ad7326 | pastith | * </TD>
|
58 | 14ad7326 | pastith | * </TR>
|
59 | 14ad7326 | pastith | * <TR>
|
60 | 14ad7326 | pastith | * <TD WIDTH="33%">ISO Latin 1</TD>
|
61 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
62 | 14ad7326 | pastith | * <P ALIGN="CENTER">ISO-8859-1
|
63 | 14ad7326 | pastith | * </TD>
|
64 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
65 | 14ad7326 | pastith | * <P ALIGN="CENTER">MIME
|
66 | 14ad7326 | pastith | * </TD>
|
67 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
68 | 14ad7326 | pastith | * <P ALIGN="CENTER">ISO-8859-1
|
69 | 14ad7326 | pastith | * </TD>
|
70 | 14ad7326 | pastith | * </TR>
|
71 | 14ad7326 | pastith | * <TR>
|
72 | 14ad7326 | pastith | * <TD WIDTH="33%">ISO Latin 2</TD>
|
73 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
74 | 14ad7326 | pastith | * <P ALIGN="CENTER">ISO-8859-2
|
75 | 14ad7326 | pastith | * </TD>
|
76 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
77 | 14ad7326 | pastith | * <P ALIGN="CENTER">MIME
|
78 | 14ad7326 | pastith | * </TD>
|
79 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
80 | 14ad7326 | pastith | * <P ALIGN="CENTER">ISO-8859-2
|
81 | 14ad7326 | pastith | * </TD>
|
82 | 14ad7326 | pastith | * </TR>
|
83 | 14ad7326 | pastith | * <TR>
|
84 | 14ad7326 | pastith | * <TD WIDTH="33%">ISO Latin 3</TD>
|
85 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
86 | 14ad7326 | pastith | * <P ALIGN="CENTER">ISO-8859-3
|
87 | 14ad7326 | pastith | * </TD>
|
88 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
89 | 14ad7326 | pastith | * <P ALIGN="CENTER">MIME
|
90 | 14ad7326 | pastith | * </TD>
|
91 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
92 | 14ad7326 | pastith | * <P ALIGN="CENTER">ISO-8859-3
|
93 | 14ad7326 | pastith | * </TD>
|
94 | 14ad7326 | pastith | * </TR>
|
95 | 14ad7326 | pastith | * <TR>
|
96 | 14ad7326 | pastith | * <TD WIDTH="33%">ISO Latin 4</TD>
|
97 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
98 | 14ad7326 | pastith | * <P ALIGN="CENTER">ISO-8859-4
|
99 | 14ad7326 | pastith | * </TD>
|
100 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
101 | 14ad7326 | pastith | * <P ALIGN="CENTER">MIME
|
102 | 14ad7326 | pastith | * </TD>
|
103 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
104 | 14ad7326 | pastith | * <P ALIGN="CENTER">ISO-8859-4
|
105 | 14ad7326 | pastith | * </TD>
|
106 | 14ad7326 | pastith | * </TR>
|
107 | 14ad7326 | pastith | * <TR>
|
108 | 14ad7326 | pastith | * <TD WIDTH="33%">ISO Latin Cyrillic</TD>
|
109 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
110 | 14ad7326 | pastith | * <P ALIGN="CENTER">ISO-8859-5
|
111 | 14ad7326 | pastith | * </TD>
|
112 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
113 | 14ad7326 | pastith | * <P ALIGN="CENTER">MIME
|
114 | 14ad7326 | pastith | * </TD>
|
115 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
116 | 14ad7326 | pastith | * <P ALIGN="CENTER">ISO-8859-5
|
117 | 14ad7326 | pastith | * </TD>
|
118 | 14ad7326 | pastith | * </TR>
|
119 | 14ad7326 | pastith | * <TR>
|
120 | 14ad7326 | pastith | * <TD WIDTH="33%">ISO Latin Arabic</TD>
|
121 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
122 | 14ad7326 | pastith | * <P ALIGN="CENTER">ISO-8859-6
|
123 | 14ad7326 | pastith | * </TD>
|
124 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
125 | 14ad7326 | pastith | * <P ALIGN="CENTER">MIME
|
126 | 14ad7326 | pastith | * </TD>
|
127 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
128 | 14ad7326 | pastith | * <P ALIGN="CENTER">ISO-8859-6
|
129 | 14ad7326 | pastith | * </TD>
|
130 | 14ad7326 | pastith | * </TR>
|
131 | 14ad7326 | pastith | * <TR>
|
132 | 14ad7326 | pastith | * <TD WIDTH="33%">ISO Latin Greek</TD>
|
133 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
134 | 14ad7326 | pastith | * <P ALIGN="CENTER">ISO-8859-7
|
135 | 14ad7326 | pastith | * </TD>
|
136 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
137 | 14ad7326 | pastith | * <P ALIGN="CENTER">MIME
|
138 | 14ad7326 | pastith | * </TD>
|
139 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
140 | 14ad7326 | pastith | * <P ALIGN="CENTER">ISO-8859-7
|
141 | 14ad7326 | pastith | * </TD>
|
142 | 14ad7326 | pastith | * </TR>
|
143 | 14ad7326 | pastith | * <TR>
|
144 | 14ad7326 | pastith | * <TD WIDTH="33%">ISO Latin Hebrew</TD>
|
145 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
146 | 14ad7326 | pastith | * <P ALIGN="CENTER">ISO-8859-8
|
147 | 14ad7326 | pastith | * </TD>
|
148 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
149 | 14ad7326 | pastith | * <P ALIGN="CENTER">MIME
|
150 | 14ad7326 | pastith | * </TD>
|
151 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
152 | 14ad7326 | pastith | * <P ALIGN="CENTER">ISO-8859-8
|
153 | 14ad7326 | pastith | * </TD>
|
154 | 14ad7326 | pastith | * </TR>
|
155 | 14ad7326 | pastith | * <TR>
|
156 | 14ad7326 | pastith | * <TD WIDTH="33%">ISO Latin 5</TD>
|
157 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
158 | 14ad7326 | pastith | * <P ALIGN="CENTER">ISO-8859-9
|
159 | 14ad7326 | pastith | * </TD>
|
160 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
161 | 14ad7326 | pastith | * <P ALIGN="CENTER">MIME
|
162 | 14ad7326 | pastith | * </TD>
|
163 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
164 | 14ad7326 | pastith | * <P ALIGN="CENTER">ISO-8859-9
|
165 | 14ad7326 | pastith | * </TD>
|
166 | 14ad7326 | pastith | * </TR>
|
167 | 14ad7326 | pastith | * <TR>
|
168 | 14ad7326 | pastith | * <TD WIDTH="33%">EBCDIC: US</TD>
|
169 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
170 | 14ad7326 | pastith | * <P ALIGN="CENTER">ebcdic-cp-us
|
171 | 14ad7326 | pastith | * </TD>
|
172 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
173 | 14ad7326 | pastith | * <P ALIGN="CENTER">IANA
|
174 | 14ad7326 | pastith | * </TD>
|
175 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
176 | 14ad7326 | pastith | * <P ALIGN="CENTER">cp037
|
177 | 14ad7326 | pastith | * </TD>
|
178 | 14ad7326 | pastith | * </TR>
|
179 | 14ad7326 | pastith | * <TR>
|
180 | 14ad7326 | pastith | * <TD WIDTH="33%">EBCDIC: Canada</TD>
|
181 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
182 | 14ad7326 | pastith | * <P ALIGN="CENTER">ebcdic-cp-ca
|
183 | 14ad7326 | pastith | * </TD>
|
184 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
185 | 14ad7326 | pastith | * <P ALIGN="CENTER">IANA
|
186 | 14ad7326 | pastith | * </TD>
|
187 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
188 | 14ad7326 | pastith | * <P ALIGN="CENTER">cp037
|
189 | 14ad7326 | pastith | * </TD>
|
190 | 14ad7326 | pastith | * </TR>
|
191 | 14ad7326 | pastith | * <TR>
|
192 | 14ad7326 | pastith | * <TD WIDTH="33%">EBCDIC: Netherlands</TD>
|
193 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
194 | 14ad7326 | pastith | * <P ALIGN="CENTER">ebcdic-cp-nl
|
195 | 14ad7326 | pastith | * </TD>
|
196 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
197 | 14ad7326 | pastith | * <P ALIGN="CENTER">IANA
|
198 | 14ad7326 | pastith | * </TD>
|
199 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
200 | 14ad7326 | pastith | * <P ALIGN="CENTER">cp037
|
201 | 14ad7326 | pastith | * </TD>
|
202 | 14ad7326 | pastith | * </TR>
|
203 | 14ad7326 | pastith | * <TR>
|
204 | 14ad7326 | pastith | * <TD WIDTH="33%">EBCDIC: Denmark</TD>
|
205 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
206 | 14ad7326 | pastith | * <P ALIGN="CENTER">ebcdic-cp-dk
|
207 | 14ad7326 | pastith | * </TD>
|
208 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
209 | 14ad7326 | pastith | * <P ALIGN="CENTER">IANA
|
210 | 14ad7326 | pastith | * </TD>
|
211 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
212 | 14ad7326 | pastith | * <P ALIGN="CENTER">cp277
|
213 | 14ad7326 | pastith | * </TD>
|
214 | 14ad7326 | pastith | * </TR>
|
215 | 14ad7326 | pastith | * <TR>
|
216 | 14ad7326 | pastith | * <TD WIDTH="33%">EBCDIC: Norway</TD>
|
217 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
218 | 14ad7326 | pastith | * <P ALIGN="CENTER">ebcdic-cp-no
|
219 | 14ad7326 | pastith | * </TD>
|
220 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
221 | 14ad7326 | pastith | * <P ALIGN="CENTER">IANA
|
222 | 14ad7326 | pastith | * </TD>
|
223 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
224 | 14ad7326 | pastith | * <P ALIGN="CENTER">cp277
|
225 | 14ad7326 | pastith | * </TD>
|
226 | 14ad7326 | pastith | * </TR>
|
227 | 14ad7326 | pastith | * <TR>
|
228 | 14ad7326 | pastith | * <TD WIDTH="33%">EBCDIC: Finland</TD>
|
229 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
230 | 14ad7326 | pastith | * <P ALIGN="CENTER">ebcdic-cp-fi
|
231 | 14ad7326 | pastith | * </TD>
|
232 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
233 | 14ad7326 | pastith | * <P ALIGN="CENTER">IANA
|
234 | 14ad7326 | pastith | * </TD>
|
235 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
236 | 14ad7326 | pastith | * <P ALIGN="CENTER">cp278
|
237 | 14ad7326 | pastith | * </TD>
|
238 | 14ad7326 | pastith | * </TR>
|
239 | 14ad7326 | pastith | * <TR>
|
240 | 14ad7326 | pastith | * <TD WIDTH="33%">EBCDIC: Sweden</TD>
|
241 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
242 | 14ad7326 | pastith | * <P ALIGN="CENTER">ebcdic-cp-se
|
243 | 14ad7326 | pastith | * </TD>
|
244 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
245 | 14ad7326 | pastith | * <P ALIGN="CENTER">IANA
|
246 | 14ad7326 | pastith | * </TD>
|
247 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
248 | 14ad7326 | pastith | * <P ALIGN="CENTER">cp278
|
249 | 14ad7326 | pastith | * </TD>
|
250 | 14ad7326 | pastith | * </TR>
|
251 | 14ad7326 | pastith | * <TR>
|
252 | 14ad7326 | pastith | * <TD WIDTH="33%">EBCDIC: Italy</TD>
|
253 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
254 | 14ad7326 | pastith | * <P ALIGN="CENTER">ebcdic-cp-it
|
255 | 14ad7326 | pastith | * </TD>
|
256 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
257 | 14ad7326 | pastith | * <P ALIGN="CENTER">IANA
|
258 | 14ad7326 | pastith | * </TD>
|
259 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
260 | 14ad7326 | pastith | * <P ALIGN="CENTER">cp280
|
261 | 14ad7326 | pastith | * </TD>
|
262 | 14ad7326 | pastith | * </TR>
|
263 | 14ad7326 | pastith | * <TR>
|
264 | 14ad7326 | pastith | * <TD WIDTH="33%">EBCDIC: Spain, Latin America</TD>
|
265 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
266 | 14ad7326 | pastith | * <P ALIGN="CENTER">ebcdic-cp-es
|
267 | 14ad7326 | pastith | * </TD>
|
268 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
269 | 14ad7326 | pastith | * <P ALIGN="CENTER">IANA
|
270 | 14ad7326 | pastith | * </TD>
|
271 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
272 | 14ad7326 | pastith | * <P ALIGN="CENTER">cp284
|
273 | 14ad7326 | pastith | * </TD>
|
274 | 14ad7326 | pastith | * </TR>
|
275 | 14ad7326 | pastith | * <TR>
|
276 | 14ad7326 | pastith | * <TD WIDTH="33%">EBCDIC: Great Britain</TD>
|
277 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
278 | 14ad7326 | pastith | * <P ALIGN="CENTER">ebcdic-cp-gb
|
279 | 14ad7326 | pastith | * </TD>
|
280 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
281 | 14ad7326 | pastith | * <P ALIGN="CENTER">IANA
|
282 | 14ad7326 | pastith | * </TD>
|
283 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
284 | 14ad7326 | pastith | * <P ALIGN="CENTER">cp285
|
285 | 14ad7326 | pastith | * </TD>
|
286 | 14ad7326 | pastith | * </TR>
|
287 | 14ad7326 | pastith | * <TR>
|
288 | 14ad7326 | pastith | * <TD WIDTH="33%">EBCDIC: France</TD>
|
289 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
290 | 14ad7326 | pastith | * <P ALIGN="CENTER">ebcdic-cp-fr
|
291 | 14ad7326 | pastith | * </TD>
|
292 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
293 | 14ad7326 | pastith | * <P ALIGN="CENTER">IANA
|
294 | 14ad7326 | pastith | * </TD>
|
295 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
296 | 14ad7326 | pastith | * <P ALIGN="CENTER">cp297
|
297 | 14ad7326 | pastith | * </TD>
|
298 | 14ad7326 | pastith | * </TR>
|
299 | 14ad7326 | pastith | * <TR>
|
300 | 14ad7326 | pastith | * <TD WIDTH="33%">EBCDIC: Arabic</TD>
|
301 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
302 | 14ad7326 | pastith | * <P ALIGN="CENTER">ebcdic-cp-ar1
|
303 | 14ad7326 | pastith | * </TD>
|
304 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
305 | 14ad7326 | pastith | * <P ALIGN="CENTER">IANA
|
306 | 14ad7326 | pastith | * </TD>
|
307 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
308 | 14ad7326 | pastith | * <P ALIGN="CENTER">cp420
|
309 | 14ad7326 | pastith | * </TD>
|
310 | 14ad7326 | pastith | * </TR>
|
311 | 14ad7326 | pastith | * <TR>
|
312 | 14ad7326 | pastith | * <TD WIDTH="33%">EBCDIC: Hebrew</TD>
|
313 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
314 | 14ad7326 | pastith | * <P ALIGN="CENTER">ebcdic-cp-he
|
315 | 14ad7326 | pastith | * </TD>
|
316 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
317 | 14ad7326 | pastith | * <P ALIGN="CENTER">IANA
|
318 | 14ad7326 | pastith | * </TD>
|
319 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
320 | 14ad7326 | pastith | * <P ALIGN="CENTER">cp424
|
321 | 14ad7326 | pastith | * </TD>
|
322 | 14ad7326 | pastith | * </TR>
|
323 | 14ad7326 | pastith | * <TR>
|
324 | 14ad7326 | pastith | * <TD WIDTH="33%">EBCDIC: Switzerland</TD>
|
325 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
326 | 14ad7326 | pastith | * <P ALIGN="CENTER">ebcdic-cp-ch
|
327 | 14ad7326 | pastith | * </TD>
|
328 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
329 | 14ad7326 | pastith | * <P ALIGN="CENTER">IANA
|
330 | 14ad7326 | pastith | * </TD>
|
331 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
332 | 14ad7326 | pastith | * <P ALIGN="CENTER">cp500
|
333 | 14ad7326 | pastith | * </TD>
|
334 | 14ad7326 | pastith | * </TR>
|
335 | 14ad7326 | pastith | * <TR>
|
336 | 14ad7326 | pastith | * <TD WIDTH="33%">EBCDIC: Roece</TD>
|
337 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
338 | 14ad7326 | pastith | * <P ALIGN="CENTER">ebcdic-cp-roece
|
339 | 14ad7326 | pastith | * </TD>
|
340 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
341 | 14ad7326 | pastith | * <P ALIGN="CENTER">IANA
|
342 | 14ad7326 | pastith | * </TD>
|
343 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
344 | 14ad7326 | pastith | * <P ALIGN="CENTER">cp870
|
345 | 14ad7326 | pastith | * </TD>
|
346 | 14ad7326 | pastith | * </TR>
|
347 | 14ad7326 | pastith | * <TR>
|
348 | 14ad7326 | pastith | * <TD WIDTH="33%">EBCDIC: Yogoslavia</TD>
|
349 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
350 | 14ad7326 | pastith | * <P ALIGN="CENTER">ebcdic-cp-yu
|
351 | 14ad7326 | pastith | * </TD>
|
352 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
353 | 14ad7326 | pastith | * <P ALIGN="CENTER">IANA
|
354 | 14ad7326 | pastith | * </TD>
|
355 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
356 | 14ad7326 | pastith | * <P ALIGN="CENTER">cp870
|
357 | 14ad7326 | pastith | * </TD>
|
358 | 14ad7326 | pastith | * </TR>
|
359 | 14ad7326 | pastith | * <TR>
|
360 | 14ad7326 | pastith | * <TD WIDTH="33%">EBCDIC: Iceland</TD>
|
361 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
362 | 14ad7326 | pastith | * <P ALIGN="CENTER">ebcdic-cp-is
|
363 | 14ad7326 | pastith | * </TD>
|
364 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
365 | 14ad7326 | pastith | * <P ALIGN="CENTER">IANA
|
366 | 14ad7326 | pastith | * </TD>
|
367 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
368 | 14ad7326 | pastith | * <P ALIGN="CENTER">cp871
|
369 | 14ad7326 | pastith | * </TD>
|
370 | 14ad7326 | pastith | * </TR>
|
371 | 14ad7326 | pastith | * <TR>
|
372 | 14ad7326 | pastith | * <TD WIDTH="33%">EBCDIC: Urdu</TD>
|
373 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
374 | 14ad7326 | pastith | * <P ALIGN="CENTER">ebcdic-cp-ar2
|
375 | 14ad7326 | pastith | * </TD>
|
376 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
377 | 14ad7326 | pastith | * <P ALIGN="CENTER">IANA
|
378 | 14ad7326 | pastith | * </TD>
|
379 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
380 | 14ad7326 | pastith | * <P ALIGN="CENTER">cp918
|
381 | 14ad7326 | pastith | * </TD>
|
382 | 14ad7326 | pastith | * </TR>
|
383 | 14ad7326 | pastith | * <TR>
|
384 | 14ad7326 | pastith | * <TD WIDTH="33%">Chinese for PRC, mixed 1/2 byte</TD>
|
385 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
386 | 14ad7326 | pastith | * <P ALIGN="CENTER">gb2312
|
387 | 14ad7326 | pastith | * </TD>
|
388 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
389 | 14ad7326 | pastith | * <P ALIGN="CENTER">MIME
|
390 | 14ad7326 | pastith | * </TD>
|
391 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
392 | 14ad7326 | pastith | * <P ALIGN="CENTER">GB2312
|
393 | 14ad7326 | pastith | * </TD>
|
394 | 14ad7326 | pastith | * </TR>
|
395 | 14ad7326 | pastith | * <TR>
|
396 | 14ad7326 | pastith | * <TD WIDTH="33%">Extended Unix Code, packed for Japanese</TD>
|
397 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
398 | 14ad7326 | pastith | * <P ALIGN="CENTER">euc-jp
|
399 | 14ad7326 | pastith | * </TD>
|
400 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
401 | 14ad7326 | pastith | * <P ALIGN="CENTER">MIME
|
402 | 14ad7326 | pastith | * </TD>
|
403 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
404 | 14ad7326 | pastith | * <P ALIGN="CENTER">eucjis
|
405 | 14ad7326 | pastith | * </TD>
|
406 | 14ad7326 | pastith | * </TR>
|
407 | 14ad7326 | pastith | * <TR>
|
408 | 14ad7326 | pastith | * <TD WIDTH="33%">Japanese: iso-2022-jp</TD>
|
409 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
410 | 14ad7326 | pastith | * <P ALIGN="CENTER">iso-2020-jp
|
411 | 14ad7326 | pastith | * </TD>
|
412 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
413 | 14ad7326 | pastith | * <P ALIGN="CENTER">MIME
|
414 | 14ad7326 | pastith | * </TD>
|
415 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
416 | 14ad7326 | pastith | * <P ALIGN="CENTER">JIS
|
417 | 14ad7326 | pastith | * </TD>
|
418 | 14ad7326 | pastith | * </TR>
|
419 | 14ad7326 | pastith | * <TR>
|
420 | 14ad7326 | pastith | * <TD WIDTH="33%">Japanese: Shift JIS</TD>
|
421 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
422 | 14ad7326 | pastith | * <P ALIGN="CENTER">Shift_JIS
|
423 | 14ad7326 | pastith | * </TD>
|
424 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
425 | 14ad7326 | pastith | * <P ALIGN="CENTER">MIME
|
426 | 14ad7326 | pastith | * </TD>
|
427 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
428 | 14ad7326 | pastith | * <P ALIGN="CENTER">SJIS
|
429 | 14ad7326 | pastith | * </TD>
|
430 | 14ad7326 | pastith | * </TR>
|
431 | 14ad7326 | pastith | * <TR>
|
432 | 14ad7326 | pastith | * <TD WIDTH="33%">Chinese: Big5</TD>
|
433 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
434 | 14ad7326 | pastith | * <P ALIGN="CENTER">Big5
|
435 | 14ad7326 | pastith | * </TD>
|
436 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
437 | 14ad7326 | pastith | * <P ALIGN="CENTER">MIME
|
438 | 14ad7326 | pastith | * </TD>
|
439 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
440 | 14ad7326 | pastith | * <P ALIGN="CENTER">Big5
|
441 | 14ad7326 | pastith | * </TD>
|
442 | 14ad7326 | pastith | * </TR>
|
443 | 14ad7326 | pastith | * <TR>
|
444 | 14ad7326 | pastith | * <TD WIDTH="33%">Extended Unix Code, packed for Korean</TD>
|
445 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
446 | 14ad7326 | pastith | * <P ALIGN="CENTER">euc-kr
|
447 | 14ad7326 | pastith | * </TD>
|
448 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
449 | 14ad7326 | pastith | * <P ALIGN="CENTER">MIME
|
450 | 14ad7326 | pastith | * </TD>
|
451 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
452 | 14ad7326 | pastith | * <P ALIGN="CENTER">iso2022kr
|
453 | 14ad7326 | pastith | * </TD>
|
454 | 14ad7326 | pastith | * </TR>
|
455 | 14ad7326 | pastith | * <TR>
|
456 | 14ad7326 | pastith | * <TD WIDTH="33%">Cyrillic</TD>
|
457 | 14ad7326 | pastith | * <TD WIDTH="15%">
|
458 | 14ad7326 | pastith | * <P ALIGN="CENTER">koi8-r
|
459 | 14ad7326 | pastith | * </TD>
|
460 | 14ad7326 | pastith | * <TD WIDTH="12%">
|
461 | 14ad7326 | pastith | * <P ALIGN="CENTER">MIME
|
462 | 14ad7326 | pastith | * </TD>
|
463 | 14ad7326 | pastith | * <TD WIDTH="31%">
|
464 | 14ad7326 | pastith | * <P ALIGN="CENTER">koi8-r
|
465 | 14ad7326 | pastith | * </TD>
|
466 | 14ad7326 | pastith | * </TR>
|
467 | 14ad7326 | pastith | * </TABLE>
|
468 | 14ad7326 | pastith | *
|
469 | 14ad7326 | pastith | * @version $Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $
|
470 | 14ad7326 | pastith | * @author TAMURA Kent <kent@trl.ibm.co.jp>
|
471 | 14ad7326 | pastith | */
|
472 | 14ad7326 | pastith | public class MIME2Java { |
473 | 14ad7326 | pastith | |
474 | 14ad7326 | pastith | /**
|
475 | 14ad7326 | pastith | *
|
476 | 14ad7326 | pastith | */
|
477 | 14ad7326 | pastith | static private Hashtable s_enchash; |
478 | 14ad7326 | pastith | /**
|
479 | 14ad7326 | pastith | *
|
480 | 14ad7326 | pastith | */
|
481 | 14ad7326 | pastith | static private Hashtable s_revhash; |
482 | 14ad7326 | pastith | |
483 | 14ad7326 | pastith | static {
|
484 | 14ad7326 | pastith | s_enchash = new Hashtable(); |
485 | 14ad7326 | pastith | // <preferred MIME name>, <Java encoding name>
|
486 | 14ad7326 | pastith | s_enchash.put("UTF-8", "UTF8"); |
487 | 14ad7326 | pastith | s_enchash.put("US-ASCII", "8859_1"); // ? |
488 | 14ad7326 | pastith | s_enchash.put("ISO-8859-1", "8859_1"); |
489 | 14ad7326 | pastith | s_enchash.put("ISO-8859-2", "8859_2"); |
490 | 14ad7326 | pastith | s_enchash.put("ISO-8859-3", "8859_3"); |
491 | 14ad7326 | pastith | s_enchash.put("ISO-8859-4", "8859_4"); |
492 | 14ad7326 | pastith | s_enchash.put("ISO-8859-5", "8859_5"); |
493 | 14ad7326 | pastith | s_enchash.put("ISO-8859-6", "8859_6"); |
494 | 14ad7326 | pastith | s_enchash.put("ISO-8859-7", "8859_7"); |
495 | 14ad7326 | pastith | s_enchash.put("ISO-8859-8", "8859_8"); |
496 | 14ad7326 | pastith | s_enchash.put("ISO-8859-9", "8859_9"); |
497 | 14ad7326 | pastith | s_enchash.put("ISO-2022-JP", "JIS"); |
498 | 14ad7326 | pastith | s_enchash.put("SHIFT_JIS", "SJIS"); |
499 | 14ad7326 | pastith | s_enchash.put("EUC-JP", "EUCJIS"); |
500 | 14ad7326 | pastith | s_enchash.put("GB2312", "GB2312"); |
501 | 14ad7326 | pastith | s_enchash.put("BIG5", "Big5"); |
502 | 14ad7326 | pastith | s_enchash.put("EUC-KR", "KSC5601"); |
503 | 14ad7326 | pastith | s_enchash.put("ISO-2022-KR", "ISO2022KR"); |
504 | 14ad7326 | pastith | s_enchash.put("KOI8-R", "KOI8_R"); |
505 | 14ad7326 | pastith | |
506 | 14ad7326 | pastith | s_enchash.put("EBCDIC-CP-US", "CP037"); |
507 | 14ad7326 | pastith | s_enchash.put("EBCDIC-CP-CA", "CP037"); |
508 | 14ad7326 | pastith | s_enchash.put("EBCDIC-CP-NL", "CP037"); |
509 | 14ad7326 | pastith | s_enchash.put("EBCDIC-CP-DK", "CP277"); |
510 | 14ad7326 | pastith | s_enchash.put("EBCDIC-CP-NO", "CP277"); |
511 | 14ad7326 | pastith | s_enchash.put("EBCDIC-CP-FI", "CP278"); |
512 | 14ad7326 | pastith | s_enchash.put("EBCDIC-CP-SE", "CP278"); |
513 | 14ad7326 | pastith | s_enchash.put("EBCDIC-CP-IT", "CP280"); |
514 | 14ad7326 | pastith | s_enchash.put("EBCDIC-CP-ES", "CP284"); |
515 | 14ad7326 | pastith | s_enchash.put("EBCDIC-CP-GB", "CP285"); |
516 | 14ad7326 | pastith | s_enchash.put("EBCDIC-CP-FR", "CP297"); |
517 | 14ad7326 | pastith | s_enchash.put("EBCDIC-CP-AR1", "CP420"); |
518 | 14ad7326 | pastith | s_enchash.put("EBCDIC-CP-HE", "CP424"); |
519 | 14ad7326 | pastith | s_enchash.put("EBCDIC-CP-CH", "CP500"); |
520 | 14ad7326 | pastith | s_enchash.put("EBCDIC-CP-ROECE", "CP870"); |
521 | 14ad7326 | pastith | s_enchash.put("EBCDIC-CP-YU", "CP870"); |
522 | 14ad7326 | pastith | s_enchash.put("EBCDIC-CP-IS", "CP871"); |
523 | 14ad7326 | pastith | s_enchash.put("EBCDIC-CP-AR2", "CP918"); |
524 | 14ad7326 | pastith | |
525 | 14ad7326 | pastith | // j:CNS11643 -> EUC-TW?
|
526 | 14ad7326 | pastith | // ISO-2022-CN? ISO-2022-CN-EXT?
|
527 | 14ad7326 | pastith | |
528 | 14ad7326 | pastith | s_revhash = new Hashtable(); |
529 | 14ad7326 | pastith | // <Java encoding name>, <preferred MIME name>
|
530 | 14ad7326 | pastith | s_revhash.put("UTF8", "UTF-8"); |
531 | 14ad7326 | pastith | //s_revhash.put("8859_1", "US-ASCII"); // ?
|
532 | 14ad7326 | pastith | s_revhash.put("8859_1", "ISO-8859-1"); |
533 | 14ad7326 | pastith | s_revhash.put("8859_2", "ISO-8859-2"); |
534 | 14ad7326 | pastith | s_revhash.put("8859_3", "ISO-8859-3"); |
535 | 14ad7326 | pastith | s_revhash.put("8859_4", "ISO-8859-4"); |
536 | 14ad7326 | pastith | s_revhash.put("8859_5", "ISO-8859-5"); |
537 | 14ad7326 | pastith | s_revhash.put("8859_6", "ISO-8859-6"); |
538 | 14ad7326 | pastith | s_revhash.put("8859_7", "ISO-8859-7"); |
539 | 14ad7326 | pastith | s_revhash.put("8859_8", "ISO-8859-8"); |
540 | 14ad7326 | pastith | s_revhash.put("8859_9", "ISO-8859-9"); |
541 | 14ad7326 | pastith | s_revhash.put("JIS", "ISO-2022-JP"); |
542 | 14ad7326 | pastith | s_revhash.put("SJIS", "Shift_JIS"); |
543 | 14ad7326 | pastith | s_revhash.put("EUCJIS", "EUC-JP"); |
544 | 14ad7326 | pastith | s_revhash.put("GB2312", "GB2312"); |
545 | 14ad7326 | pastith | s_revhash.put("BIG5", "Big5"); |
546 | 14ad7326 | pastith | s_revhash.put("KSC5601", "EUC-KR"); |
547 | 14ad7326 | pastith | s_revhash.put("ISO2022KR", "ISO-2022-KR"); |
548 | 14ad7326 | pastith | s_revhash.put("KOI8_R", "KOI8-R"); |
549 | 14ad7326 | pastith | |
550 | 14ad7326 | pastith | s_revhash.put("CP037", "EBCDIC-CP-US"); |
551 | 14ad7326 | pastith | s_revhash.put("CP037", "EBCDIC-CP-CA"); |
552 | 14ad7326 | pastith | s_revhash.put("CP037", "EBCDIC-CP-NL"); |
553 | 14ad7326 | pastith | s_revhash.put("CP277", "EBCDIC-CP-DK"); |
554 | 14ad7326 | pastith | s_revhash.put("CP277", "EBCDIC-CP-NO"); |
555 | 14ad7326 | pastith | s_revhash.put("CP278", "EBCDIC-CP-FI"); |
556 | 14ad7326 | pastith | s_revhash.put("CP278", "EBCDIC-CP-SE"); |
557 | 14ad7326 | pastith | s_revhash.put("CP280", "EBCDIC-CP-IT"); |
558 | 14ad7326 | pastith | s_revhash.put("CP284", "EBCDIC-CP-ES"); |
559 | 14ad7326 | pastith | s_revhash.put("CP285", "EBCDIC-CP-GB"); |
560 | 14ad7326 | pastith | s_revhash.put("CP297", "EBCDIC-CP-FR"); |
561 | 14ad7326 | pastith | s_revhash.put("CP420", "EBCDIC-CP-AR1"); |
562 | 14ad7326 | pastith | s_revhash.put("CP424", "EBCDIC-CP-HE"); |
563 | 14ad7326 | pastith | s_revhash.put("CP500", "EBCDIC-CP-CH"); |
564 | 14ad7326 | pastith | s_revhash.put("CP870", "EBCDIC-CP-ROECE"); |
565 | 14ad7326 | pastith | s_revhash.put("CP870", "EBCDIC-CP-YU"); |
566 | 14ad7326 | pastith | s_revhash.put("CP871", "EBCDIC-CP-IS"); |
567 | 14ad7326 | pastith | s_revhash.put("CP918", "EBCDIC-CP-AR2"); |
568 | 14ad7326 | pastith | } |
569 | 14ad7326 | pastith | |
570 | 14ad7326 | pastith | /**
|
571 | 14ad7326 | pastith | * Constructor.
|
572 | 14ad7326 | pastith | */
|
573 | 14ad7326 | pastith | private MIME2Java() {
|
574 | 14ad7326 | pastith | } |
575 | 14ad7326 | pastith | |
576 | 14ad7326 | pastith | /**
|
577 | 14ad7326 | pastith | * Convert a MIME charset name, also known as an XML encoding name, to a Java encoding name.
|
578 | 14ad7326 | pastith | * @param mimeCharsetName Case insensitive MIME charset name: <code>UTF-8, US-ASCII, ISO-8859-1,
|
579 | 14ad7326 | pastith | * ISO-8859-2, ISO-8859-3, ISO-8859-4, ISO-8859-5, ISO-8859-6,
|
580 | 14ad7326 | pastith | * ISO-8859-7, ISO-8859-8, ISO-8859-9, ISO-2022-JP, Shift_JIS,
|
581 | 14ad7326 | pastith | * EUC-JP, GB2312, Big5, EUC-KR, ISO-2022-KR, KOI8-R,
|
582 | 14ad7326 | pastith | * EBCDIC-CP-US, EBCDIC-CP-CA, EBCDIC-CP-NL, EBCDIC-CP-DK,
|
583 | 14ad7326 | pastith | * EBCDIC-CP-NO, EBCDIC-CP-FI, EBCDIC-CP-SE, EBCDIC-CP-IT,
|
584 | 14ad7326 | pastith | * EBCDIC-CP-ES, EBCDIC-CP-GB, EBCDIC-CP-FR, EBCDIC-CP-AR1,
|
585 | 14ad7326 | pastith | * EBCDIC-CP-HE, EBCDIC-CP-CH, EBCDIC-CP-ROECE, EBCDIC-CP-YU,
|
586 | 14ad7326 | pastith | * EBCDIC-CP-IS and EBCDIC-CP-AR2</code>.
|
587 | 14ad7326 | pastith | * @return Java encoding name, or <var>null</var> if <var>mimeCharsetName</var>
|
588 | 14ad7326 | pastith | * is unknown.
|
589 | 14ad7326 | pastith | * @see #reverse
|
590 | 14ad7326 | pastith | */
|
591 | 14ad7326 | pastith | public static String convert(String mimeCharsetName) { |
592 | 14ad7326 | pastith | return (String)s_enchash.get(mimeCharsetName.toUpperCase()); |
593 | 14ad7326 | pastith | } |
594 | 14ad7326 | pastith | |
595 | 14ad7326 | pastith | /**
|
596 | 14ad7326 | pastith | * Convert a Java encoding name to MIME charset name.
|
597 | 14ad7326 | pastith | * Available values of <i>encoding</i> are "UTF8", "8859_1", "8859_2", "8859_3", "8859_4",
|
598 | 14ad7326 | pastith | * "8859_5", "8859_6", "8859_7", "8859_8", "8859_9", "JIS", "SJIS", "EUCJIS",
|
599 | 14ad7326 | pastith | * "GB2312", "BIG5", "KSC5601", "ISO2022KR", "KOI8_R", "CP037", "CP277", "CP278",
|
600 | 14ad7326 | pastith | * "CP280", "CP284", "CP285", "CP297", "CP420", "CP424", "CP500", "CP870", "CP871" and "CP918".
|
601 | 14ad7326 | pastith | * @param encoding Case insensitive Java encoding name: <code>UTF8, 8859_1, 8859_2, 8859_3,
|
602 | 14ad7326 | pastith | * 8859_4, 8859_5, 8859_6, 8859_7, 8859_8, 8859_9, JIS, SJIS, EUCJIS,
|
603 | 14ad7326 | pastith | * GB2312, BIG5, KSC5601, ISO2022KR, KOI8_R, CP037, CP277, CP278,
|
604 | 14ad7326 | pastith | * CP280, CP284, CP285, CP297, CP420, CP424, CP500, CP870, CP871
|
605 | 14ad7326 | pastith | * and CP918</code>.
|
606 | 14ad7326 | pastith | * @return MIME charset name, or <var>null</var> if <var>encoding</var> is unknown.
|
607 | 14ad7326 | pastith | * @see #convert
|
608 | 14ad7326 | pastith | */
|
609 | 14ad7326 | pastith | public static String reverse(String encoding) { |
610 | 14ad7326 | pastith | return (String)s_revhash.get(encoding.toUpperCase()); |
611 | 14ad7326 | pastith | } |
612 | 14ad7326 | pastith | } |