source: trunk/Packages/synapse/source/lib/synachar.pas

Last change on this file was 2, checked in by chronos, 12 years ago
  • Přidáno: Základní kostra projektu.
  • Přidáno: Knihovna synapse.
File size: 72.3 KB
Line 
1{==============================================================================|
2| Project : Ararat Synapse | 005.002.002 |
3|==============================================================================|
4| Content: Charset conversion support |
5|==============================================================================|
6| Copyright (c)1999-2004, Lukas Gebauer |
7| All rights reserved. |
8| |
9| Redistribution and use in source and binary forms, with or without |
10| modification, are permitted provided that the following conditions are met: |
11| |
12| Redistributions of source code must retain the above copyright notice, this |
13| list of conditions and the following disclaimer. |
14| |
15| Redistributions in binary form must reproduce the above copyright notice, |
16| this list of conditions and the following disclaimer in the documentation |
17| and/or other materials provided with the distribution. |
18| |
19| Neither the name of Lukas Gebauer nor the names of its contributors may |
20| be used to endorse or promote products derived from this software without |
21| specific prior written permission. |
22| |
23| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
24| AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
25| IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
26| ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR |
27| ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
28| DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
29| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
30| CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
31| LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
32| OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH |
33| DAMAGE. |
34|==============================================================================|
35| The Initial Developer of the Original Code is Lukas Gebauer (Czech Republic).|
36| Portions created by Lukas Gebauer are Copyright (c)2000-2004. |
37| All Rights Reserved. |
38|==============================================================================|
39| Contributor(s): |
40|==============================================================================|
41| History: see HISTORY.HTM from distribution package |
42| (Found at URL: http://www.ararat.cz/synapse/) |
43|==============================================================================}
44
45{: @abstract(Charset conversion support)
46This unit contains a routines for lot of charset conversions.
47
48It using built-in conversion tables or external Iconv library. Iconv is used
49 when needed conversion is known by Iconv library. When Iconv library is not
50 found or Iconv not know requested conversion, then are internal routines used
51 for conversion. (You can disable Iconv support from your program too!)
52
53Internal routines knows all major charsets for Europe or America. For East-Asian
54 charsets you must use Iconv library!
55}
56
57{$IFDEF FPC}
58 {$MODE DELPHI}
59{$ENDIF}
60{$Q-}
61{$H+}
62
63{$IFDEF UNICODE}
64 {$WARN IMPLICIT_STRING_CAST OFF}
65 {$WARN IMPLICIT_STRING_CAST_LOSS OFF}
66{$ENDIF}
67
68unit synachar;
69
70interface
71
72uses
73{$IFNDEF WIN32}
74 {$IFNDEF FPC}
75 Libc,
76 {$ELSE}
77 {$IFDEF FPC_USE_LIBC}
78 Libc,
79 {$ENDIF}
80 {$ENDIF}
81{$ELSE}
82 Windows,
83{$ENDIF}
84 SysUtils,
85 synautil, synacode, synaicnv;
86
87type
88 {:Type with all supported charsets.}
89 TMimeChar = (ISO_8859_1, ISO_8859_2, ISO_8859_3, ISO_8859_4, ISO_8859_5,
90 ISO_8859_6, ISO_8859_7, ISO_8859_8, ISO_8859_9, ISO_8859_10, ISO_8859_13,
91 ISO_8859_14, ISO_8859_15, CP1250, CP1251, CP1252, CP1253, CP1254, CP1255,
92 CP1256, CP1257, CP1258, KOI8_R, CP895, CP852, UCS_2, UCS_4, UTF_8, UTF_7,
93 UTF_7mod, UCS_2LE, UCS_4LE,
94 //next is supported by Iconv only...
95 UTF_16, UTF_16LE, UTF_32, UTF_32LE, C99, JAVA, ISO_8859_16, KOI8_U, KOI8_RU,
96 CP862, CP866, MAC, MACCE, MACICE, MACCRO, MACRO, MACCYR, MACUK, MACGR, MACTU,
97 MACHEB, MACAR, MACTH, ROMAN8, NEXTSTEP, ARMASCII, GEORGIAN_AC, GEORGIAN_PS,
98 KOI8_T, MULELAO, CP1133, TIS620, CP874, VISCII, TCVN, ISO_IR_14, JIS_X0201,
99 JIS_X0208, JIS_X0212, GB1988_80, GB2312_80, ISO_IR_165, ISO_IR_149, EUC_JP,
100 SHIFT_JIS, CP932, ISO_2022_JP, ISO_2022_JP1, ISO_2022_JP2, GB2312, CP936,
101 GB18030, ISO_2022_CN, ISO_2022_CNE, HZ, EUC_TW, BIG5, CP950, BIG5_HKSCS,
102 EUC_KR, CP949, CP1361, ISO_2022_KR, CP737, CP775, CP853, CP855, CP857,
103 CP858, CP860, CP861, CP863, CP864, CP865, CP869, CP1125);
104
105 {:Set of any charsets.}
106 TMimeSetChar = set of TMimeChar;
107
108const
109 {:Set of charsets supported by Iconv library only.}
110 IconvOnlyChars: set of TMimeChar = [UTF_16, UTF_16LE, UTF_32, UTF_32LE,
111 C99, JAVA, ISO_8859_16, KOI8_U, KOI8_RU, CP862, CP866, MAC, MACCE, MACICE,
112 MACCRO, MACRO, MACCYR, MACUK, MACGR, MACTU, MACHEB, MACAR, MACTH, ROMAN8,
113 NEXTSTEP, ARMASCII, GEORGIAN_AC, GEORGIAN_PS, KOI8_T, MULELAO, CP1133,
114 TIS620, CP874, VISCII, TCVN, ISO_IR_14, JIS_X0201, JIS_X0208, JIS_X0212,
115 GB1988_80, GB2312_80, ISO_IR_165, ISO_IR_149, EUC_JP, SHIFT_JIS, CP932,
116 ISO_2022_JP, ISO_2022_JP1, ISO_2022_JP2, GB2312, CP936, GB18030,
117 ISO_2022_CN, ISO_2022_CNE, HZ, EUC_TW, BIG5, CP950, BIG5_HKSCS, EUC_KR,
118 CP949, CP1361, ISO_2022_KR, CP737, CP775, CP853, CP855, CP857, CP858,
119 CP860, CP861, CP863, CP864, CP865, CP869, CP1125];
120
121 {:Set of charsets supported by internal routines only.}
122 NoIconvChars: set of TMimeChar = [CP895, UTF_7mod];
123
124 {:null character replace table. (Usable for disable charater replacing.)}
125 Replace_None: array[0..0] of Word =
126 (0);
127
128 {:Character replace table for remove Czech diakritics.}
129 Replace_Czech: array[0..59] of Word =
130 (
131 $00E1, $0061,
132 $010D, $0063,
133 $010F, $0064,
134 $010E, $0044,
135 $00E9, $0065,
136 $011B, $0065,
137 $00ED, $0069,
138 $0148, $006E,
139 $00F3, $006F,
140 $0159, $0072,
141 $0161, $0073,
142 $0165, $0074,
143 $00FA, $0075,
144 $016F, $0075,
145 $00FD, $0079,
146 $017E, $007A,
147 $00C1, $0041,
148 $010C, $0043,
149 $00C9, $0045,
150 $011A, $0045,
151 $00CD, $0049,
152 $0147, $004E,
153 $00D3, $004F,
154 $0158, $0052,
155 $0160, $0053,
156 $0164, $0054,
157 $00DA, $0055,
158 $016E, $0055,
159 $00DD, $0059,
160 $017D, $005A
161 );
162
163var
164 {:By this you can generally disable/enable Iconv support.}
165 DisableIconv: Boolean = False;
166
167 {:Default set of charsets for @link(IdealCharsetCoding) function.}
168 IdealCharsets: TMimeSetChar =
169 [ISO_8859_1, ISO_8859_2, ISO_8859_3, ISO_8859_4, ISO_8859_5,
170 ISO_8859_6, ISO_8859_7, ISO_8859_8, ISO_8859_9, ISO_8859_10,
171 KOI8_R, KOI8_U
172 {$IFNDEF CIL} //error URW778 ??? :-O
173 , GB2312, EUC_KR, ISO_2022_JP, EUC_TW
174 {$ENDIF}
175 ];
176
177{==============================================================================}
178{:Convert Value from one charset to another. See: @link(CharsetConversionEx)}
179function CharsetConversion(const Value: AnsiString; CharFrom: TMimeChar;
180 CharTo: TMimeChar): AnsiString;
181
182{:Convert Value from one charset to another with additional character conversion.
183see: @link(Replace_None) and @link(Replace_Czech)}
184function CharsetConversionEx(const Value: AnsiString; CharFrom: TMimeChar;
185 CharTo: TMimeChar; const TransformTable: array of Word): AnsiString;
186
187{:Convert Value from one charset to another with additional character conversion.
188 This funtion is similar to @link(CharsetConversionEx), but you can disable
189 transliteration of unconvertible characters.}
190function CharsetConversionTrans(Value: AnsiString; CharFrom: TMimeChar;
191 CharTo: TMimeChar; const TransformTable: array of Word; Translit: Boolean): AnsiString;
192
193{:Returns charset used by operating system.}
194function GetCurCP: TMimeChar;
195
196{:Returns charset used by operating system as OEM charset. (in Windows DOS box,
197 for example)}
198function GetCurOEMCP: TMimeChar;
199
200{:Converting string with charset name to TMimeChar.}
201function GetCPFromID(Value: AnsiString): TMimeChar;
202
203{:Converting TMimeChar to string with name of charset.}
204function GetIDFromCP(Value: TMimeChar): AnsiString;
205
206{:return @true when value need to be converted. (It is not 7-bit ASCII)}
207function NeedCharsetConversion(const Value: AnsiString): Boolean;
208
209{:Finding best target charset from set of TMimeChars with minimal count of
210 unconvertible characters.}
211function IdealCharsetCoding(const Value: AnsiString; CharFrom: TMimeChar;
212 CharTo: TMimeSetChar): TMimeChar;
213
214{:Return BOM (Byte Order Mark) for given unicode charset.}
215function GetBOM(Value: TMimeChar): AnsiString;
216
217{:Convert binary string with unicode content to WideString.}
218function StringToWide(const Value: AnsiString): WideString;
219
220{:Convert WideString to binary string with unicode content.}
221function WideToString(const Value: WideString): AnsiString;
222
223{==============================================================================}
224implementation
225
226//character transcoding tables X to UCS-2
227{
228//dummy table
229$0080, $0081, $0082, $0083, $0084, $0085, $0086, $0087,
230$0088, $0089, $008A, $008B, $008C, $008D, $008E, $008F,
231$0090, $0091, $0092, $0093, $0094, $0095, $0096, $0097,
232$0098, $0099, $009A, $009B, $009C, $009D, $009E, $009F,
233$00A0, $00A1, $00A2, $00A3, $00A4, $00A5, $00A6, $00A7,
234$00A8, $00A9, $00AA, $00AB, $00AC, $00AD, $00AE, $00AF,
235$00B0, $00B1, $00B2, $00B3, $00B4, $00B5, $00B6, $00B7,
236$00B8, $00B9, $00BA, $00BB, $00BC, $00BD, $00BE, $00BF,
237$00C0, $00C1, $00C2, $00C3, $00C4, $00C5, $00C6, $00C7,
238$00C8, $00C9, $00CA, $00CB, $00CC, $00CD, $00CE, $00CF,
239$00D0, $00D1, $00D2, $00D3, $00D4, $00D5, $00D6, $00D7,
240$00D8, $00D9, $00DA, $00DB, $00DC, $00DD, $00DE, $00DF,
241$00E0, $00E1, $00E2, $00E3, $00E4, $00E5, $00E6, $00E7,
242$00E8, $00E9, $00EA, $00EB, $00EC, $00ED, $00EE, $00EF,
243$00F0, $00F1, $00F2, $00F3, $00F4, $00F5, $00F6, $00F7,
244$00F8, $00F9, $00FA, $00FB, $00FC, $00FD, $00FE, $00FF
245}
246
247const
248
249{Latin-1
250 Danish, Dutch, English, Faeroese, Finnish, French, German, Icelandic,
251 Irish, Italian, Norwegian, Portuguese, Spanish and Swedish.
252}
253 CharISO_8859_1: array[128..255] of Word =
254 (
255 $0080, $0081, $0082, $0083, $0084, $0085, $0086, $0087,
256 $0088, $0089, $008A, $008B, $008C, $008D, $008E, $008F,
257 $0090, $0091, $0092, $0093, $0094, $0095, $0096, $0097,
258 $0098, $0099, $009A, $009B, $009C, $009D, $009E, $009F,
259 $00A0, $00A1, $00A2, $00A3, $00A4, $00A5, $00A6, $00A7,
260 $00A8, $00A9, $00AA, $00AB, $00AC, $00AD, $00AE, $00AF,
261 $00B0, $00B1, $00B2, $00B3, $00B4, $00B5, $00B6, $00B7,
262 $00B8, $00B9, $00BA, $00BB, $00BC, $00BD, $00BE, $00BF,
263 $00C0, $00C1, $00C2, $00C3, $00C4, $00C5, $00C6, $00C7,
264 $00C8, $00C9, $00CA, $00CB, $00CC, $00CD, $00CE, $00CF,
265 $00D0, $00D1, $00D2, $00D3, $00D4, $00D5, $00D6, $00D7,
266 $00D8, $00D9, $00DA, $00DB, $00DC, $00DD, $00DE, $00DF,
267 $00E0, $00E1, $00E2, $00E3, $00E4, $00E5, $00E6, $00E7,
268 $00E8, $00E9, $00EA, $00EB, $00EC, $00ED, $00EE, $00EF,
269 $00F0, $00F1, $00F2, $00F3, $00F4, $00F5, $00F6, $00F7,
270 $00F8, $00F9, $00FA, $00FB, $00FC, $00FD, $00FE, $00FF
271 );
272
273{Latin-2
274 Albanian, Czech, English, German, Hungarian, Polish, Rumanian,
275 Serbo-Croatian, Slovak, Slovene and Swedish.
276}
277 CharISO_8859_2: array[128..255] of Word =
278 (
279 $0080, $0081, $0082, $0083, $0084, $0085, $0086, $0087,
280 $0088, $0089, $008A, $008B, $008C, $008D, $008E, $008F,
281 $0090, $0091, $0092, $0093, $0094, $0095, $0096, $0097,
282 $0098, $0099, $009A, $009B, $009C, $009D, $009E, $009F,
283 $00A0, $0104, $02D8, $0141, $00A4, $013D, $015A, $00A7,
284 $00A8, $0160, $015E, $0164, $0179, $00AD, $017D, $017B,
285 $00B0, $0105, $02DB, $0142, $00B4, $013E, $015B, $02C7,
286 $00B8, $0161, $015F, $0165, $017A, $02DD, $017E, $017C,
287 $0154, $00C1, $00C2, $0102, $00C4, $0139, $0106, $00C7,
288 $010C, $00C9, $0118, $00CB, $011A, $00CD, $00CE, $010E,
289 $0110, $0143, $0147, $00D3, $00D4, $0150, $00D6, $00D7,
290 $0158, $016E, $00DA, $0170, $00DC, $00DD, $0162, $00DF,
291 $0155, $00E1, $00E2, $0103, $00E4, $013A, $0107, $00E7,
292 $010D, $00E9, $0119, $00EB, $011B, $00ED, $00EE, $010F,
293 $0111, $0144, $0148, $00F3, $00F4, $0151, $00F6, $00F7,
294 $0159, $016F, $00FA, $0171, $00FC, $00FD, $0163, $02D9
295 );
296
297{Latin-3
298 Afrikaans, Catalan, English, Esperanto, French, Galician,
299 German, Italian, Maltese and Turkish.
300}
301 CharISO_8859_3: array[128..255] of Word =
302 (
303 $0080, $0081, $0082, $0083, $0084, $0085, $0086, $0087,
304 $0088, $0089, $008A, $008B, $008C, $008D, $008E, $008F,
305 $0090, $0091, $0092, $0093, $0094, $0095, $0096, $0097,
306 $0098, $0099, $009A, $009B, $009C, $009D, $009E, $009F,
307 $00A0, $0126, $02D8, $00A3, $00A4, $FFFD, $0124, $00A7,
308 $00A8, $0130, $015E, $011E, $0134, $00AD, $FFFD, $017B,
309 $00B0, $0127, $00B2, $00B3, $00B4, $00B5, $0125, $00B7,
310 $00B8, $0131, $015F, $011F, $0135, $00BD, $FFFD, $017C,
311 $00C0, $00C1, $00C2, $FFFD, $00C4, $010A, $0108, $00C7,
312 $00C8, $00C9, $00CA, $00CB, $00CC, $00CD, $00CE, $00CF,
313 $FFFD, $00D1, $00D2, $00D3, $00D4, $0120, $00D6, $00D7,
314 $011C, $00D9, $00DA, $00DB, $00DC, $016C, $015C, $00DF,
315 $00E0, $00E1, $00E2, $FFFD, $00E4, $010B, $0109, $00E7,
316 $00E8, $00E9, $00EA, $00EB, $00EC, $00ED, $00EE, $00EF,
317 $FFFD, $00F1, $00F2, $00F3, $00F4, $0121, $00F6, $00F7,
318 $011D, $00F9, $00FA, $00FB, $00FC, $016D, $015D, $02D9
319 );
320
321{Latin-4
322 Danish, English, Estonian, Finnish, German, Greenlandic,
323 Lappish, Latvian, Lithuanian, Norwegian and Swedish.
324}
325 CharISO_8859_4: array[128..255] of Word =
326 (
327 $0080, $0081, $0082, $0083, $0084, $0085, $0086, $0087,
328 $0088, $0089, $008A, $008B, $008C, $008D, $008E, $008F,
329 $0090, $0091, $0092, $0093, $0094, $0095, $0096, $0097,
330 $0098, $0099, $009A, $009B, $009C, $009D, $009E, $009F,
331 $00A0, $0104, $0138, $0156, $00A4, $0128, $013B, $00A7,
332 $00A8, $0160, $0112, $0122, $0166, $00AD, $017D, $00AF,
333 $00B0, $0105, $02DB, $0157, $00B4, $0129, $013C, $02C7,
334 $00B8, $0161, $0113, $0123, $0167, $014A, $017E, $014B,
335 $0100, $00C1, $00C2, $00C3, $00C4, $00C5, $00C6, $012E,
336 $010C, $00C9, $0118, $00CB, $0116, $00CD, $00CE, $012A,
337 $0110, $0145, $014C, $0136, $00D4, $00D5, $00D6, $00D7,
338 $00D8, $0172, $00DA, $00DB, $00DC, $0168, $016A, $00DF,
339 $0101, $00E1, $00E2, $00E3, $00E4, $00E5, $00E6, $012F,
340 $010D, $00E9, $0119, $00EB, $0117, $00ED, $00EE, $012B,
341 $0111, $0146, $014D, $0137, $00F4, $00F5, $00F6, $00F7,
342 $00F8, $0173, $00FA, $00FB, $00FC, $0169, $016B, $02D9
343 );
344
345{CYRILLIC
346 Bulgarian, Bielorussian, English, Macedonian, Russian,
347 Serbo-Croatian and Ukrainian.
348}
349 CharISO_8859_5: array[128..255] of Word =
350 (
351 $0080, $0081, $0082, $0083, $0084, $0085, $0086, $0087,
352 $0088, $0089, $008A, $008B, $008C, $008D, $008E, $008F,
353 $0090, $0091, $0092, $0093, $0094, $0095, $0096, $0097,
354 $0098, $0099, $009A, $009B, $009C, $009D, $009E, $009F,
355 $00A0, $0401, $0402, $0403, $0404, $0405, $0406, $0407,
356 $0408, $0409, $040A, $040B, $040C, $00AD, $040E, $040F,
357 $0410, $0411, $0412, $0413, $0414, $0415, $0416, $0417,
358 $0418, $0419, $041A, $041B, $041C, $041D, $041E, $041F,
359 $0420, $0421, $0422, $0423, $0424, $0425, $0426, $0427,
360 $0428, $0429, $042A, $042B, $042C, $042D, $042E, $042F,
361 $0430, $0431, $0432, $0433, $0434, $0435, $0436, $0437,
362 $0438, $0439, $043A, $043B, $043C, $043D, $043E, $043F,
363 $0440, $0441, $0442, $0443, $0444, $0445, $0446, $0447,
364 $0448, $0449, $044A, $044B, $044C, $044D, $044E, $044F,
365 $2116, $0451, $0452, $0453, $0454, $0455, $0456, $0457,
366 $0458, $0459, $045A, $045B, $045C, $00A7, $045E, $045F
367 );
368
369{ARABIC
370}
371 CharISO_8859_6: array[128..255] of Word =
372 (
373 $0080, $0081, $0082, $0083, $0084, $0085, $0086, $0087,
374 $0088, $0089, $008A, $008B, $008C, $008D, $008E, $008F,
375 $0090, $0091, $0092, $0093, $0094, $0095, $0096, $0097,
376 $0098, $0099, $009A, $009B, $009C, $009D, $009E, $009F,
377 $00A0, $FFFD, $FFFD, $FFFD, $00A4, $FFFD, $FFFD, $FFFD,
378 $FFFD, $FFFD, $FFFD, $FFFD, $060C, $00AD, $FFFD, $FFFD,
379 $FFFD, $FFFD, $FFFD, $FFFD, $FFFD, $FFFD, $FFFD, $FFFD,
380 $FFFD, $FFFD, $FFFD, $061B, $FFFD, $FFFD, $FFFD, $061F,
381 $FFFD, $0621, $0622, $0623, $0624, $0625, $0626, $0627,
382 $0628, $0629, $062A, $062B, $062C, $062D, $062E, $062F,
383 $0630, $0631, $0632, $0633, $0634, $0635, $0636, $0637,
384 $0638, $0639, $063A, $FFFD, $FFFD, $FFFD, $FFFD, $FFFD,
385 $0640, $0641, $0642, $0643, $0644, $0645, $0646, $0647,
386 $0648, $0649, $064A, $064B, $064C, $064D, $064E, $064F,
387 $0650, $0651, $0652, $FFFD, $FFFD, $FFFD, $FFFD, $FFFD,
388 $FFFD, $FFFD, $FFFD, $FFFD, $FFFD, $FFFD, $FFFD, $FFFD
389 );
390
391{GREEK
392}
393 CharISO_8859_7: array[128..255] of Word =
394 (
395 $0080, $0081, $0082, $0083, $0084, $0085, $0086, $0087,
396 $0088, $0089, $008A, $008B, $008C, $008D, $008E, $008F,
397 $0090, $0091, $0092, $0093, $0094, $0095, $0096, $0097,
398 $0098, $0099, $009A, $009B, $009C, $009D, $009E, $009F,
399 $00A0, $2018, $2019, $00A3, $FFFD, $FFFD, $00A6, $00A7,
400 $00A8, $00A9, $FFFD, $00AB, $00AC, $00AD, $FFFD, $2015,
401 $00B0, $00B1, $00B2, $00B3, $0384, $0385, $0386, $00B7,
402 $0388, $0389, $038A, $00BB, $038C, $00BD, $038E, $038F,
403 $0390, $0391, $0392, $0393, $0394, $0395, $0396, $0397,
404 $0398, $0399, $039A, $039B, $039C, $039D, $039E, $039F,
405 $03A0, $03A1, $FFFD, $03A3, $03A4, $03A5, $03A6, $03A7,
406 $03A8, $03A9, $03AA, $03AB, $03AC, $03AD, $03AE, $03AF,
407 $03B0, $03B1, $03B2, $03B3, $03B4, $03B5, $03B6, $03B7,
408 $03B8, $03B9, $03BA, $03BB, $03BC, $03BD, $03BE, $03BF,
409 $03C0, $03C1, $03C2, $03C3, $03C4, $03C5, $03C6, $03C7,
410 $03C8, $03C9, $03CA, $03CB, $03CC, $03CD, $03CE, $FFFD
411 );
412
413{HEBREW
414}
415 CharISO_8859_8: array[128..255] of Word =
416 (
417 $0080, $0081, $0082, $0083, $0084, $0085, $0086, $0087,
418 $0088, $0089, $008A, $008B, $008C, $008D, $008E, $008F,
419 $0090, $0091, $0092, $0093, $0094, $0095, $0096, $0097,
420 $0098, $0099, $009A, $009B, $009C, $009D, $009E, $009F,
421 $00A0, $FFFD, $00A2, $00A3, $00A4, $00A5, $00A6, $00A7,
422 $00A8, $00A9, $00D7, $00AB, $00AC, $00AD, $00AE, $00AF,
423 $00B0, $00B1, $00B2, $00B3, $00B4, $00B5, $00B6, $00B7,
424 $00B8, $00B9, $00F7, $00BB, $00BC, $00BD, $00BE, $FFFD,
425 $FFFD, $FFFD, $FFFD, $FFFD, $FFFD, $FFFD, $FFFD, $FFFD,
426 $FFFD, $FFFD, $FFFD, $FFFD, $FFFD, $FFFD, $FFFD, $FFFD,
427 $FFFD, $FFFD, $FFFD, $FFFD, $FFFD, $FFFD, $FFFD, $FFFD,
428 $FFFD, $FFFD, $FFFD, $FFFD, $FFFD, $FFFD, $FFFD, $2017,
429 $05D0, $05D1, $05D2, $05D3, $05D4, $05D5, $05D6, $05D7,
430 $05D8, $05D9, $05DA, $05DB, $05DC, $05DD, $05DE, $05DF,
431 $05E0, $05E1, $05E2, $05E3, $05E4, $05E5, $05E6, $05E7,
432 $05E8, $05E9, $05EA, $FFFD, $FFFD, $200E, $200F, $FFFD
433 );
434
435{Latin-5
436 English, Finnish, French, German, Irish, Italian, Norwegian,
437 Portuguese, Spanish, Swedish and Turkish.
438}
439 CharISO_8859_9: array[128..255] of Word =
440 (
441 $0080, $0081, $0082, $0083, $0084, $0085, $0086, $0087,
442 $0088, $0089, $008A, $008B, $008C, $008D, $008E, $008F,
443 $0090, $0091, $0092, $0093, $0094, $0095, $0096, $0097,
444 $0098, $0099, $009A, $009B, $009C, $009D, $009E, $009F,
445 $00A0, $0104, $02D8, $0141, $00A4, $013D, $015A, $00A7,
446 $00A8, $0160, $015E, $0164, $0179, $00AD, $017D, $017B,
447 $00B0, $0105, $02DB, $0142, $00B4, $013E, $015B, $02C7,
448 $00B8, $0161, $015F, $0165, $017A, $02DD, $017E, $017C,
449 $0154, $00C1, $00C2, $0102, $00C4, $0139, $0106, $00C7,
450 $010C, $00C9, $0118, $00CB, $011A, $00CD, $00CE, $010E,
451 $011E, $00D1, $00D2, $00D3, $00D4, $00D5, $00D6, $00D7,
452 $00D8, $00D9, $00DA, $00DB, $00DC, $0130, $015E, $00DF,
453 $00E0, $00E1, $00E2, $00E3, $00E4, $00E5, $00E6, $00E7,
454 $00E8, $00E9, $00EA, $00EB, $00EC, $00ED, $00EE, $00EF,
455 $011F, $00F1, $00F2, $00F3, $00F4, $00F5, $00F6, $00F7,
456 $00F8, $00F9, $00FA, $00FB, $00FC, $0131, $015F, $00FF
457 );
458
459{Latin-6
460 Danish, English, Estonian, Faeroese, Finnish, German, Greenlandic,
461 Icelandic, Lappish, Latvian, Lithuanian, Norwegian and Swedish.
462}
463 CharISO_8859_10: array[128..255] of Word =
464 (
465 $0080, $0081, $0082, $0083, $0084, $0085, $0086, $0087,
466 $0088, $0089, $008A, $008B, $008C, $008D, $008E, $008F,
467 $0090, $0091, $0092, $0093, $0094, $0095, $0096, $0097,
468 $0098, $0099, $009A, $009B, $009C, $009D, $009E, $009F,
469 $00A0, $0104, $0112, $0122, $012A, $0128, $0136, $00A7,
470 $013B, $0110, $0160, $0166, $017D, $00AD, $016A, $014A,
471 $00B0, $0105, $0113, $0123, $012B, $0129, $0137, $00B7,
472 $013C, $0111, $0161, $0167, $017E, $2015, $016B, $014B,
473 $0100, $00C1, $00C2, $00C3, $00C4, $00C5, $00C6, $012E,
474 $010C, $00C9, $0118, $00CB, $0116, $00CD, $00CE, $00CF,
475 $00D0, $0145, $014C, $00D3, $00D4, $00D5, $00D6, $0168,
476 $00D8, $0172, $00DA, $00DB, $00DC, $00DD, $00DE, $00DF,
477 $0101, $00E1, $00E2, $00E3, $00E4, $00E5, $00E6, $012F,
478 $010D, $00E9, $0119, $00EB, $0117, $00ED, $00EE, $00EF,
479 $00F0, $0146, $014D, $00F3, $00F4, $00F5, $00F6, $0169,
480 $00F8, $0173, $00FA, $00FB, $00FC, $00FD, $00FE, $0138
481 );
482
483 CharISO_8859_13: array[128..255] of Word =
484 (
485 $0080, $0081, $0082, $0083, $0084, $0085, $0086, $0087,
486 $0088, $0089, $008A, $008B, $008C, $008D, $008E, $008F,
487 $0090, $0091, $0092, $0093, $0094, $0095, $0096, $0097,
488 $0098, $0099, $009A, $009B, $009C, $009D, $009E, $009F,
489 $00A0, $201D, $00A2, $00A3, $00A4, $201E, $00A6, $00A7,
490 $00D8, $00A9, $0156, $00AB, $00AC, $00AD, $00AE, $00C6,
491 $00B0, $00B1, $00B2, $00B3, $201C, $00B5, $00B6, $00B7,
492 $00F8, $00B9, $0157, $00BB, $00BC, $00BD, $00BE, $00E6,
493 $0104, $012E, $0100, $0106, $00C4, $00C5, $0118, $0112,
494 $010C, $00C9, $0179, $0116, $0122, $0136, $012A, $013B,
495 $0160, $0143, $0145, $00D3, $014C, $00D5, $00D6, $00D7,
496 $0172, $0141, $015A, $016A, $00DC, $017B, $017D, $00DF,
497 $0105, $012F, $0101, $0107, $00E4, $00E5, $0119, $0113,
498 $010D, $00E9, $017A, $0117, $0123, $0137, $012B, $013C,
499 $0161, $0144, $0146, $00F3, $014D, $00F5, $00F6, $00F7,
500 $0173, $0142, $015B, $016B, $00FC, $017C, $017E, $2019
501 );
502
503 CharISO_8859_14: array[128..255] of Word =
504 (
505 $0080, $0081, $0082, $0083, $0084, $0085, $0086, $0087,
506 $0088, $0089, $008A, $008B, $008C, $008D, $008E, $008F,
507 $0090, $0091, $0092, $0093, $0094, $0095, $0096, $0097,
508 $0098, $0099, $009A, $009B, $009C, $009D, $009E, $009F,
509 $00A0, $1E02, $1E03, $00A3, $010A, $010B, $1E0A, $00A7,
510 $1E80, $00A9, $1E82, $1E0B, $1EF2, $00AD, $00AE, $0178,
511 $1E1E, $1E1F, $0120, $0121, $1E40, $1E41, $00B6, $1E56,
512 $1E81, $1E57, $1E83, $1E60, $1EF3, $1E84, $1E85, $1E61,
513 $00C0, $00C1, $00C2, $00C3, $00C4, $00C5, $00C6, $00C7,
514 $00C8, $00C9, $00CA, $00CB, $00CC, $00CD, $00CE, $00CF,
515 $0174, $00D1, $00D2, $00D3, $00D4, $00D5, $00D6, $1E6A,
516 $00D8, $00D9, $00DA, $00DB, $00DC, $00DD, $0176, $00DF,
517 $00E0, $00E1, $00E2, $00E3, $00E4, $00E5, $00E6, $00E7,
518 $00E8, $00E9, $00EA, $00EB, $00EC, $00ED, $00EE, $00EF,
519 $0175, $00F1, $00F2, $00F3, $00F4, $00F5, $00F6, $1E6B,
520 $00F8, $00F9, $00FA, $00FB, $00FC, $00FD, $0177, $00FF
521 );
522
523 CharISO_8859_15: array[128..255] of Word =
524 (
525 $0080, $0081, $0082, $0083, $0084, $0085, $0086, $0087,
526 $0088, $0089, $008A, $008B, $008C, $008D, $008E, $008F,
527 $0090, $0091, $0092, $0093, $0094, $0095, $0096, $0097,
528 $0098, $0099, $009A, $009B, $009C, $009D, $009E, $009F,
529 $00A0, $00A1, $00A2, $00A3, $20AC, $00A5, $0160, $00A7,
530 $0161, $00A9, $00AA, $00AB, $00AC, $00AD, $00AE, $00AF,
531 $00B0, $00B1, $00B2, $00B3, $017D, $00B5, $00B6, $00B7,
532 $017E, $00B9, $00BA, $00BB, $0152, $0153, $0178, $00BF,
533 $00C0, $00C1, $00C2, $00C3, $00C4, $00C5, $00C6, $00C7,
534 $00C8, $00C9, $00CA, $00CB, $00CC, $00CD, $00CE, $00CF,
535 $00D0, $00D1, $00D2, $00D3, $00D4, $00D5, $00D6, $00D7,
536 $00D8, $00D9, $00DA, $00DB, $00DC, $00DD, $00DE, $00DF,
537 $00E0, $00E1, $00E2, $00E3, $00E4, $00E5, $00E6, $00E7,
538 $00E8, $00E9, $00EA, $00EB, $00EC, $00ED, $00EE, $00EF,
539 $00F0, $00F1, $00F2, $00F3, $00F4, $00F5, $00F6, $00F7,
540 $00F8, $00F9, $00FA, $00FB, $00FC, $00FD, $00FE, $00FF
541 );
542
543{Eastern European
544}
545 CharCP_1250: array[128..255] of Word =
546 (
547 $20AC, $FFFD, $201A, $FFFD, $201E, $2026, $2020, $2021,
548 $FFFD, $2030, $0160, $2039, $015A, $0164, $017D, $0179,
549 $FFFD, $2018, $2019, $201C, $201D, $2022, $2013, $2014,
550 $FFFD, $2122, $0161, $203A, $015B, $0165, $017E, $017A,
551 $00A0, $02C7, $02D8, $0141, $00A4, $0104, $00A6, $00A7,
552 $00A8, $00A9, $015E, $00AB, $00AC, $00AD, $00AE, $017B,
553 $00B0, $00B1, $02DB, $0142, $00B4, $00B5, $00B6, $00B7,
554 $00B8, $0105, $015F, $00BB, $013D, $02DD, $013E, $017C,
555 $0154, $00C1, $00C2, $0102, $00C4, $0139, $0106, $00C7,
556 $010C, $00C9, $0118, $00CB, $011A, $00CD, $00CE, $010E,
557 $0110, $0143, $0147, $00D3, $00D4, $0150, $00D6, $00D7,
558 $0158, $016E, $00DA, $0170, $00DC, $00DD, $0162, $00DF,
559 $0155, $00E1, $00E2, $0103, $00E4, $013A, $0107, $00E7,
560 $010D, $00E9, $0119, $00EB, $011B, $00ED, $00EE, $010F,
561 $0111, $0144, $0148, $00F3, $00F4, $0151, $00F6, $00F7,
562 $0159, $016F, $00FA, $0171, $00FC, $00FD, $0163, $02D9
563 );
564
565{Cyrillic
566}
567 CharCP_1251: array[128..255] of Word =
568 (
569 $0402, $0403, $201A, $0453, $201E, $2026, $2020, $2021,
570 $20AC, $2030, $0409, $2039, $040A, $040C, $040B, $040F,
571 $0452, $2018, $2019, $201C, $201D, $2022, $2013, $2014,
572 $FFFD, $2122, $0459, $203A, $045A, $045C, $045B, $045F,
573 $00A0, $040E, $045E, $0408, $00A4, $0490, $00A6, $00A7,
574 $0401, $00A9, $0404, $00AB, $00AC, $00AD, $00AE, $0407,
575 $00B0, $00B1, $0406, $0456, $0491, $00B5, $00B6, $00B7,
576 $0451, $2116, $0454, $00BB, $0458, $0405, $0455, $0457,
577 $0410, $0411, $0412, $0413, $0414, $0415, $0416, $0417,
578 $0418, $0419, $041A, $041B, $041C, $041D, $041E, $041F,
579 $0420, $0421, $0422, $0423, $0424, $0425, $0426, $0427,
580 $0428, $0429, $042A, $042B, $042C, $042D, $042E, $042F,
581 $0430, $0431, $0432, $0433, $0434, $0435, $0436, $0437,
582 $0438, $0439, $043A, $043B, $043C, $043D, $043E, $043F,
583 $0440, $0441, $0442, $0443, $0444, $0445, $0446, $0447,
584 $0448, $0449, $044A, $044B, $044C, $044D, $044E, $044F
585 );
586
587{Latin-1 (US, Western Europe)
588}
589 CharCP_1252: array[128..255] of Word =
590 (
591 $20AC, $FFFD, $201A, $0192, $201E, $2026, $2020, $2021,
592 $02C6, $2030, $0160, $2039, $0152, $FFFD, $017D, $FFFD,
593 $FFFD, $2018, $2019, $201C, $201D, $2022, $2013, $2014,
594 $02DC, $2122, $0161, $203A, $0153, $FFFD, $017E, $0178,
595 $00A0, $00A1, $00A2, $00A3, $00A4, $00A5, $00A6, $00A7,
596 $00A8, $00A9, $00AA, $00AB, $00AC, $00AD, $00AE, $00AF,
597 $00B0, $00B1, $00B2, $00B3, $00B4, $00B5, $00B6, $00B7,
598 $00B8, $00B9, $00BA, $00BB, $00BC, $00BD, $00BE, $00BF,
599 $00C0, $00C1, $00C2, $00C3, $00C4, $00C5, $00C6, $00C7,
600 $00C8, $00C9, $00CA, $00CB, $00CC, $00CD, $00CE, $00CF,
601 $00D0, $00D1, $00D2, $00D3, $00D4, $00D5, $00D6, $00D7,
602 $00D8, $00D9, $00DA, $00DB, $00DC, $00DD, $00DE, $00DF,
603 $00E0, $00E1, $00E2, $00E3, $00E4, $00E5, $00E6, $00E7,
604 $00E8, $00E9, $00EA, $00EB, $00EC, $00ED, $00EE, $00EF,
605 $00F0, $00F1, $00F2, $00F3, $00F4, $00F5, $00F6, $00F7,
606 $00F8, $00F9, $00FA, $00FB, $00FC, $00FD, $00FE, $00FF
607 );
608
609{Greek
610}
611 CharCP_1253: array[128..255] of Word =
612 (
613 $20AC, $FFFD, $201A, $0192, $201E, $2026, $2020, $2021,
614 $FFFD, $2030, $FFFD, $2039, $FFFD, $FFFD, $FFFD, $FFFD,
615 $FFFD, $2018, $2019, $201C, $201D, $2022, $2013, $2014,
616 $FFFD, $2122, $FFFD, $203A, $FFFD, $FFFD, $FFFD, $FFFD,
617 $00A0, $0385, $0386, $00A3, $00A4, $00A5, $00A6, $00A7,
618 $00A8, $00A9, $FFFD, $00AB, $00AC, $00AD, $00AE, $2015,
619 $00B0, $00B1, $00B2, $00B3, $0384, $00B5, $00B6, $00B7,
620 $0388, $0389, $038A, $00BB, $038C, $00BD, $038E, $038F,
621 $0390, $0391, $0392, $0393, $0394, $0395, $0396, $0397,
622 $0398, $0399, $039A, $039B, $039C, $039D, $039E, $039F,
623 $03A0, $03A1, $FFFD, $03A3, $03A4, $03A5, $03A6, $03A7,
624 $03A8, $03A9, $03AA, $03AB, $03AC, $03AD, $03AE, $03AF,
625 $03B0, $03B1, $03B2, $03B3, $03B4, $03B5, $03B6, $03B7,
626 $03B8, $03B9, $03BA, $03BB, $03BC, $03BD, $03BE, $03BF,
627 $03C0, $03C1, $03C2, $03C3, $03C4, $03C5, $03C6, $03C7,
628 $03C8, $03C9, $03CA, $03CB, $03CC, $03CD, $03CE, $FFFD
629 );
630
631{Turkish
632}
633 CharCP_1254: array[128..255] of Word =
634 (
635 $20AC, $FFFD, $201A, $0192, $201E, $2026, $2020, $2021,
636 $02C6, $2030, $0160, $2039, $0152, $FFFD, $FFFD, $FFFD,
637 $FFFD, $2018, $2019, $201C, $201D, $2022, $2013, $2014,
638 $02DC, $2122, $0161, $203A, $0153, $FFFD, $FFFD, $0178,
639 $00A0, $00A1, $00A2, $00A3, $00A4, $00A5, $00A6, $00A7,
640 $00A8, $00A9, $00AA, $00AB, $00AC, $00AD, $00AE, $00AF,
641 $00B0, $00B1, $00B2, $00B3, $00B4, $00B5, $00B6, $00B7,
642 $00B8, $00B9, $00BA, $00BB, $00BC, $00BD, $00BE, $00BF,
643 $00C0, $00C1, $00C2, $00C3, $00C4, $00C5, $00C6, $00C7,
644 $00C8, $00C9, $00CA, $00CB, $00CC, $00CD, $00CE, $00CF,
645 $011E, $00D1, $00D2, $00D3, $00D4, $00D5, $00D6, $00D7,
646 $00D8, $00D9, $00DA, $00DB, $00DC, $0130, $015E, $00DF,
647 $00E0, $00E1, $00E2, $00E3, $00E4, $00E5, $00E6, $00E7,
648 $00E8, $00E9, $00EA, $00EB, $00EC, $00ED, $00EE, $00EF,
649 $011F, $00F1, $00F2, $00F3, $00F4, $00F5, $00F6, $00F7,
650 $00F8, $00F9, $00FA, $00FB, $00FC, $0131, $015F, $00FF
651 );
652
653{Hebrew
654}
655 CharCP_1255: array[128..255] of Word =
656 (
657 $20AC, $FFFD, $201A, $0192, $201E, $2026, $2020, $2021,
658 $02C6, $2030, $FFFD, $2039, $FFFD, $FFFD, $FFFD, $FFFD,
659 $FFFD, $2018, $2019, $201C, $201D, $2022, $2013, $2014,
660 $02DC, $2122, $FFFD, $203A, $FFFD, $FFFD, $FFFD, $FFFD,
661 $00A0, $00A1, $00A2, $00A3, $20AA, $00A5, $00A6, $00A7,
662 $00A8, $00A9, $00D7, $00AB, $00AC, $00AD, $00AE, $00AF,
663 $00B0, $00B1, $00B2, $00B3, $00B4, $00B5, $00B6, $00B7,
664 $00B8, $00B9, $00F7, $00BB, $00BC, $00BD, $00BE, $00BF,
665 $05B0, $05B1, $05B2, $05B3, $05B4, $05B5, $05B6, $05B7,
666 $05B8, $05B9, $FFFD, $05BB, $05BC, $05BD, $05BE, $05BF,
667 $05C0, $05C1, $05C2, $05C3, $05F0, $05F1, $05F2, $05F3,
668 $05F4, $FFFD, $FFFD, $FFFD, $FFFD, $FFFD, $FFFD, $FFFD,
669 $05D0, $05D1, $05D2, $05D3, $05D4, $05D5, $05D6, $05D7,
670 $05D8, $05D9, $05DA, $05DB, $05DC, $05DD, $05DE, $05DF,
671 $05E0, $05E1, $05E2, $05E3, $05E4, $05E5, $05E6, $05E7,
672 $05E8, $05E9, $05EA, $FFFD, $FFFD, $200E, $200F, $FFFD
673 );
674
675{Arabic
676}
677 CharCP_1256: array[128..255] of Word =
678 (
679 $20AC, $067E, $201A, $0192, $201E, $2026, $2020, $2021,
680 $02C6, $2030, $0679, $2039, $0152, $0686, $0698, $0688,
681 $06AF, $2018, $2019, $201C, $201D, $2022, $2013, $2014,
682 $06A9, $2122, $0691, $203A, $0153, $200C, $200D, $06BA,
683 $00A0, $060C, $00A2, $00A3, $00A4, $00A5, $00A6, $00A7,
684 $00A8, $00A9, $06BE, $00AB, $00AC, $00AD, $00AE, $00AF,
685 $00B0, $00B1, $00B2, $00B3, $00B4, $00B5, $00B6, $00B7,
686 $00B8, $00B9, $061B, $00BB, $00BC, $00BD, $00BE, $061F,
687 $06C1, $0621, $0622, $0623, $0624, $0625, $0626, $0627,
688 $0628, $0629, $062A, $062B, $062C, $062D, $062E, $062F,
689 $0630, $0631, $0632, $0633, $0634, $0635, $0636, $00D7,
690 $0637, $0638, $0639, $063A, $0640, $0641, $0642, $0643,
691 $00E0, $0644, $00E2, $0645, $0646, $0647, $0648, $00E7,
692 $00E8, $00E9, $00EA, $00EB, $0649, $064A, $00EE, $00EF,
693 $064B, $064C, $064D, $064E, $00F4, $064F, $0650, $00F7,
694 $0651, $00F9, $0652, $00FB, $00FC, $200E, $200F, $06D2
695 );
696
697{Baltic
698}
699 CharCP_1257: array[128..255] of Word =
700 (
701 $20AC, $FFFD, $201A, $FFFD, $201E, $2026, $2020, $2021,
702 $FFFD, $2030, $FFFD, $2039, $FFFD, $00A8, $02C7, $00B8,
703 $FFFD, $2018, $2019, $201C, $201D, $2022, $2013, $2014,
704 $FFFD, $2122, $FFFD, $203A, $FFFD, $00AF, $02DB, $FFFD,
705 $00A0, $FFFD, $00A2, $00A3, $00A4, $FFFD, $00A6, $00A7,
706 $00D8, $00A9, $0156, $00AB, $00AC, $00AD, $00AE, $00C6,
707 $00B0, $00B1, $00B2, $00B3, $00B4, $00B5, $00B6, $00B7,
708 $00F8, $00B9, $0157, $00BB, $00BC, $00BD, $00BE, $00E6,
709 $0104, $012E, $0100, $0106, $00C4, $00C5, $0118, $0112,
710 $010C, $00C9, $0179, $0116, $0122, $0136, $012A, $013B,
711 $0160, $0143, $0145, $00D3, $014C, $00D5, $00D6, $00D7,
712 $0172, $0141, $015A, $016A, $00DC, $017B, $017D, $00DF,
713 $0105, $012F, $0101, $0107, $00E4, $00E5, $0119, $0113,
714 $010D, $00E9, $017A, $0117, $0123, $0137, $012B, $013C,
715 $0161, $0144, $0146, $00F3, $014D, $00F5, $00F6, $00F7,
716 $0173, $0142, $015B, $016B, $00FC, $017C, $017E, $02D9
717 );
718
719{Vietnamese
720}
721 CharCP_1258: array[128..255] of Word =
722 (
723 $20AC, $FFFD, $201A, $0192, $201E, $2026, $2020, $2021,
724 $02C6, $2030, $FFFD, $2039, $0152, $FFFD, $FFFD, $FFFD,
725 $FFFD, $2018, $2019, $201C, $201D, $2022, $2013, $2014,
726 $02DC, $2122, $FFFD, $203A, $0153, $FFFD, $FFFD, $0178,
727 $00A0, $00A1, $00A2, $00A3, $00A4, $00A5, $00A6, $00A7,
728 $00A8, $00A9, $00AA, $00AB, $00AC, $00AD, $00AE, $00AF,
729 $00B0, $00B1, $00B2, $00B3, $00B4, $00B5, $00B6, $00B7,
730 $00B8, $00B9, $00BA, $00BB, $00BC, $00BD, $00BE, $00BF,
731 $00C0, $00C1, $00C2, $0102, $00C4, $00C5, $00C6, $00C7,
732 $00C8, $00C9, $00CA, $00CB, $0300, $00CD, $00CE, $00CF,
733 $0110, $00D1, $0309, $00D3, $00D4, $01A0, $00D6, $00D7,
734 $00D8, $00D9, $00DA, $00DB, $00DC, $01AF, $0303, $00DF,
735 $00E0, $00E1, $00E2, $0103, $00E4, $00E5, $00E6, $00E7,
736 $00E8, $00E9, $00EA, $00EB, $0301, $00ED, $00EE, $00EF,
737 $0111, $00F1, $0323, $00F3, $00F4, $01A1, $00F6, $00F7,
738 $00F8, $00F9, $00FA, $00FB, $00FC, $01B0, $20AB, $00FF
739 );
740
741{Cyrillic
742}
743 CharKOI8_R: array[128..255] of Word =
744 (
745 $2500, $2502, $250C, $2510, $2514, $2518, $251C, $2524,
746 $252C, $2534, $253C, $2580, $2584, $2588, $258C, $2590,
747 $2591, $2592, $2593, $2320, $25A0, $2219, $221A, $2248,
748 $2264, $2265, $00A0, $2321, $00B0, $00B2, $00B7, $00F7,
749 $2550, $2551, $2552, $0451, $2553, $2554, $2555, $2556,
750 $2557, $2558, $2559, $255A, $255B, $255C, $255D, $255E,
751 $255F, $2560, $2561, $0401, $2562, $2563, $2564, $2565,
752 $2566, $2567, $2568, $2569, $256A, $256B, $256C, $00A9,
753 $044E, $0430, $0431, $0446, $0434, $0435, $0444, $0433,
754 $0445, $0438, $0439, $043A, $043B, $043C, $043D, $043E,
755 $043F, $044F, $0440, $0441, $0442, $0443, $0436, $0432,
756 $044C, $044B, $0437, $0448, $044D, $0449, $0447, $044A,
757 $042E, $0410, $0411, $0426, $0414, $0415, $0424, $0413,
758 $0425, $0418, $0419, $041A, $041B, $041C, $041D, $041E,
759 $041F, $042F, $0420, $0421, $0422, $0423, $0416, $0412,
760 $042C, $042B, $0417, $0428, $042D, $0429, $0427, $042A
761 );
762
763{Czech (Kamenicky)
764}
765 CharCP_895: array[128..255] of Word =
766 (
767 $010C, $00FC, $00E9, $010F, $00E4, $010E, $0164, $010D,
768 $011B, $011A, $0139, $00CD, $013E, $013A, $00C4, $00C1,
769 $00C9, $017E, $017D, $00F4, $00F6, $00D3, $016F, $00DA,
770 $00FD, $00D6, $00DC, $0160, $013D, $00DD, $0158, $0165,
771 $00E1, $00ED, $00F3, $00FA, $0148, $0147, $016E, $00D4,
772 $0161, $0159, $0155, $0154, $00BC, $00A7, $00AB, $00BB,
773 $2591, $2592, $2593, $2502, $2524, $2561, $2562, $2556,
774 $2555, $2563, $2551, $2557, $255D, $255C, $255B, $2510,
775 $2514, $2534, $252C, $251C, $2500, $253C, $255E, $255F,
776 $255A, $2554, $2569, $2566, $2560, $2550, $256C, $2567,
777 $2568, $2564, $2565, $2559, $2558, $2552, $2553, $256B,
778 $256A, $2518, $250C, $2588, $2584, $258C, $2590, $2580,
779 $03B1, $03B2, $0393, $03C0, $03A3, $03C3, $03BC, $03C4,
780 $03A6, $0398, $03A9, $03B4, $221E, $2205, $03B5, $2229,
781 $2261, $00B1, $2265, $2264, $2320, $2321, $00F7, $2248,
782 $2218, $00B7, $2219, $221A, $207F, $00B2, $25A0, $00A0
783 );
784
785{Eastern European
786}
787 CharCP_852: array[128..255] of Word =
788 (
789 $00C7, $00FC, $00E9, $00E2, $00E4, $016F, $0107, $00E7,
790 $0142, $00EB, $0150, $0151, $00EE, $0179, $00C4, $0106,
791 $00C9, $0139, $013A, $00F4, $00F6, $013D, $013E, $015A,
792 $015B, $00D6, $00DC, $0164, $0165, $0141, $00D7, $010D,
793 $00E1, $00ED, $00F3, $00FA, $0104, $0105, $017D, $017E,
794 $0118, $0119, $00AC, $017A, $010C, $015F, $00AB, $00BB,
795 $2591, $2592, $2593, $2502, $2524, $00C1, $00C2, $011A,
796 $015E, $2563, $2551, $2557, $255D, $017B, $017C, $2510,
797 $2514, $2534, $252C, $251C, $2500, $253C, $0102, $0103,
798 $255A, $2554, $2569, $2566, $2560, $2550, $256C, $00A4,
799 $0111, $0110, $010E, $00CB, $010F, $0147, $00CD, $00CE,
800 $011B, $2518, $250C, $2588, $2584, $0162, $016E, $2580,
801 $00D3, $00DF, $00D4, $0143, $0144, $0148, $0160, $0161,
802 $0154, $00DA, $0155, $0170, $00FD, $00DD, $0163, $00B4,
803 $00AD, $02DD, $02DB, $02C7, $02D8, $00A7, $00F7, $00B8,
804 $00B0, $00A8, $02D9, $0171, $0158, $0159, $25A0, $00A0
805 );
806
807{==============================================================================}
808type
809 TIconvChar = record
810 Charset: TMimeChar;
811 CharName: string;
812 end;
813 TIconvArr = array [0..112] of TIconvChar;
814
815const
816 NotFoundChar = '_';
817
818var
819 SetTwo: set of TMimeChar = [UCS_2, UCS_2LE, UTF_7, UTF_7mod];
820 SetFour: set of TMimeChar = [UCS_4, UCS_4LE, UTF_8];
821 SetLE: set of TMimeChar = [UCS_2LE, UCS_4LE];
822
823 IconvArr: TIconvArr;
824
825{==============================================================================}
826function FindIconvID(const Value, Charname: string): Boolean;
827var
828 s: string;
829begin
830 Result := True;
831 //exact match
832 if Value = Charname then
833 Exit;
834 //Value is on begin of charname
835 s := Value + ' ';
836 if s = Copy(Charname, 1, Length(s)) then
837 Exit;
838 //Value is on end of charname
839 s := ' ' + Value;
840 if s = Copy(Charname, Length(Charname) - Length(s) + 1, Length(s)) then
841 Exit;
842 //value is somewhere inside charname
843 if Pos( s + ' ', Charname) > 0 then
844 Exit;
845 Result := False;
846end;
847
848function GetCPFromIconvID(Value: AnsiString): TMimeChar;
849var
850 n: integer;
851begin
852 Result := ISO_8859_1;
853 Value := UpperCase(Value);
854 for n := 0 to High(IconvArr) do
855 if FindIconvID(Value, IconvArr[n].Charname) then
856 begin
857 Result := IconvArr[n].Charset;
858 Break;
859 end;
860end;
861
862{==============================================================================}
863function GetIconvIDFromCP(Value: TMimeChar): AnsiString;
864var
865 n: integer;
866begin
867 Result := 'ISO-8859-1';
868 for n := 0 to High(IconvArr) do
869 if IconvArr[n].Charset = Value then
870 begin
871 Result := Separateleft(IconvArr[n].Charname, ' ');
872 Break;
873 end;
874end;
875
876{==============================================================================}
877function ReplaceUnicode(Value: Word; const TransformTable: array of Word): Word;
878var
879 n: integer;
880begin
881 if High(TransformTable) <> 0 then
882 for n := 0 to High(TransformTable) do
883 if not odd(n) then
884 if TransformTable[n] = Value then
885 begin
886 Value := TransformTable[n+1];
887 break;
888 end;
889 Result := Value;
890end;
891
892{==============================================================================}
893procedure CopyArray(const SourceTable: array of Word;
894 var TargetTable: array of Word);
895var
896 n: Integer;
897begin
898 for n := 0 to 127 do
899 TargetTable[n] := SourceTable[n];
900end;
901
902{==============================================================================}
903procedure GetArray(CharSet: TMimeChar; var Result: array of Word);
904begin
905 case CharSet of
906 ISO_8859_2:
907 CopyArray(CharISO_8859_2, Result);
908 ISO_8859_3:
909 CopyArray(CharISO_8859_3, Result);
910 ISO_8859_4:
911 CopyArray(CharISO_8859_4, Result);
912 ISO_8859_5:
913 CopyArray(CharISO_8859_5, Result);
914 ISO_8859_6:
915 CopyArray(CharISO_8859_6, Result);
916 ISO_8859_7:
917 CopyArray(CharISO_8859_7, Result);
918 ISO_8859_8:
919 CopyArray(CharISO_8859_8, Result);
920 ISO_8859_9:
921 CopyArray(CharISO_8859_9, Result);
922 ISO_8859_10:
923 CopyArray(CharISO_8859_10, Result);
924 ISO_8859_13:
925 CopyArray(CharISO_8859_13, Result);
926 ISO_8859_14:
927 CopyArray(CharISO_8859_14, Result);
928 ISO_8859_15:
929 CopyArray(CharISO_8859_15, Result);
930 CP1250:
931 CopyArray(CharCP_1250, Result);
932 CP1251:
933 CopyArray(CharCP_1251, Result);
934 CP1252:
935 CopyArray(CharCP_1252, Result);
936 CP1253:
937 CopyArray(CharCP_1253, Result);
938 CP1254:
939 CopyArray(CharCP_1254, Result);
940 CP1255:
941 CopyArray(CharCP_1255, Result);
942 CP1256:
943 CopyArray(CharCP_1256, Result);
944 CP1257:
945 CopyArray(CharCP_1257, Result);
946 CP1258:
947 CopyArray(CharCP_1258, Result);
948 KOI8_R:
949 CopyArray(CharKOI8_R, Result);
950 CP895:
951 CopyArray(CharCP_895, Result);
952 CP852:
953 CopyArray(CharCP_852, Result);
954 else
955 CopyArray(CharISO_8859_1, Result);
956 end;
957end;
958
959{==============================================================================}
960procedure ReadMulti(const Value: AnsiString; var Index: Integer; mb: Byte;
961 var b1, b2, b3, b4: Byte; le: boolean);
962Begin
963 b1 := 0;
964 b2 := 0;
965 b3 := 0;
966 b4 := 0;
967 if Index < 0 then
968 Index := 1;
969 if mb > 4 then
970 mb := 1;
971 if (Index + mb - 1) <= Length(Value) then
972 begin
973 if le then
974 Case mb Of
975 1:
976 b1 := Ord(Value[Index]);
977 2:
978 Begin
979 b1 := Ord(Value[Index]);
980 b2 := Ord(Value[Index + 1]);
981 End;
982 3:
983 Begin
984 b1 := Ord(Value[Index]);
985 b2 := Ord(Value[Index + 1]);
986 b3 := Ord(Value[Index + 2]);
987 End;
988 4:
989 Begin
990 b1 := Ord(Value[Index]);
991 b2 := Ord(Value[Index + 1]);
992 b3 := Ord(Value[Index + 2]);
993 b4 := Ord(Value[Index + 3]);
994 End;
995 end
996 else
997 Case mb Of
998 1:
999 b1 := Ord(Value[Index]);
1000 2:
1001 Begin
1002 b2 := Ord(Value[Index]);
1003 b1 := Ord(Value[Index + 1]);
1004 End;
1005 3:
1006 Begin
1007 b3 := Ord(Value[Index]);
1008 b2 := Ord(Value[Index + 1]);
1009 b1 := Ord(Value[Index + 2]);
1010 End;
1011 4:
1012 Begin
1013 b4 := Ord(Value[Index]);
1014 b3 := Ord(Value[Index + 1]);
1015 b2 := Ord(Value[Index + 2]);
1016 b1 := Ord(Value[Index + 3]);
1017 End;
1018 end;
1019 end;
1020 Inc(Index, mb);
1021end;
1022
1023{==============================================================================}
1024function WriteMulti(b1, b2, b3, b4: Byte; mb: Byte; le: boolean): AnsiString;
1025begin
1026 if mb > 4 then
1027 mb := 1;
1028 SetLength(Result, mb);
1029 if le then
1030 case mb Of
1031 1:
1032 Result[1] := AnsiChar(b1);
1033 2:
1034 begin
1035 Result[1] := AnsiChar(b1);
1036 Result[2] := AnsiChar(b2);
1037 end;
1038 3:
1039 begin
1040 Result[1] := AnsiChar(b1);
1041 Result[2] := AnsiChar(b2);
1042 Result[3] := AnsiChar(b3);
1043 end;
1044 4:
1045 begin
1046 Result[1] := AnsiChar(b1);
1047 Result[2] := AnsiChar(b2);
1048 Result[3] := AnsiChar(b3);
1049 Result[4] := AnsiChar(b4);
1050 end;
1051 end
1052 else
1053 case mb Of
1054 1:
1055 Result[1] := AnsiChar(b1);
1056 2:
1057 begin
1058 Result[2] := AnsiChar(b1);
1059 Result[1] := AnsiChar(b2);
1060 end;
1061 3:
1062 begin
1063 Result[3] := AnsiChar(b1);
1064 Result[2] := AnsiChar(b2);
1065 Result[1] := AnsiChar(b3);
1066 end;
1067 4:
1068 begin
1069 Result[4] := AnsiChar(b1);
1070 Result[3] := AnsiChar(b2);
1071 Result[2] := AnsiChar(b3);
1072 Result[1] := AnsiChar(b4);
1073 end;
1074 end;
1075end;
1076
1077{==============================================================================}
1078function UTF8toUCS4(const Value: AnsiString): AnsiString;
1079var
1080 n, x, ul, m: Integer;
1081 s: AnsiString;
1082 w1, w2: Word;
1083begin
1084 Result := '';
1085 n := 1;
1086 while Length(Value) >= n do
1087 begin
1088 x := Ord(Value[n]);
1089 Inc(n);
1090 if x < 128 then
1091 Result := Result + WriteMulti(x, 0, 0, 0, 4, false)
1092 else
1093 begin
1094 m := 0;
1095 if (x and $E0) = $C0 then
1096 m := $1F;
1097 if (x and $F0) = $E0 then
1098 m := $0F;
1099 if (x and $F8) = $F0 then
1100 m := $07;
1101 if (x and $FC) = $F8 then
1102 m := $03;
1103 if (x and $FE) = $FC then
1104 m := $01;
1105 ul := x and m;
1106 s := IntToBin(ul, 0);
1107 while Length(Value) >= n do
1108 begin
1109 x := Ord(Value[n]);
1110 Inc(n);
1111 if (x and $C0) = $80 then
1112 s := s + IntToBin(x and $3F, 6)
1113 else
1114 begin
1115 Dec(n);
1116 Break;
1117 end;
1118 end;
1119 ul := BinToInt(s);
1120 w1 := ul div 65536;
1121 w2 := ul mod 65536;
1122 Result := Result + WriteMulti(Lo(w2), Hi(w2), Lo(w1), Hi(w1), 4, false);
1123 end;
1124 end;
1125end;
1126
1127{==============================================================================}
1128function UCS4toUTF8(const Value: AnsiString): AnsiString;
1129var
1130 s, l, k: AnsiString;
1131 b1, b2, b3, b4: Byte;
1132 n, m, x, y: Integer;
1133 b: Byte;
1134begin
1135 Result := '';
1136 n := 1;
1137 while Length(Value) >= n do
1138 begin
1139 ReadMulti(Value, n, 4, b1, b2, b3, b4, false);
1140 if (b2 = 0) and (b3 = 0) and (b4 = 0) and (b1 < 128) then
1141 Result := Result + AnsiChar(b1)
1142 else
1143 begin
1144 x := (b1 + 256 * b2) + (b3 + 256 * b4) * 65536;
1145 l := IntToBin(x, 0);
1146 y := Length(l) div 6;
1147 s := '';
1148 for m := 1 to y do
1149 begin
1150 k := Copy(l, Length(l) - 5, 6);
1151 l := Copy(l, 1, Length(l) - 6);
1152 b := BinToInt(k) or $80;
1153 s := AnsiChar(b) + s;
1154 end;
1155 b := BinToInt(l);
1156 case y of
1157 5:
1158 b := b or $FC;
1159 4:
1160 b := b or $F8;
1161 3:
1162 b := b or $F0;
1163 2:
1164 b := b or $E0;
1165 1:
1166 b := b or $C0;
1167 end;
1168 s := AnsiChar(b) + s;
1169 Result := Result + s;
1170 end;
1171 end;
1172end;
1173
1174{==============================================================================}
1175function UTF7toUCS2(const Value: AnsiString; Modified: Boolean): AnsiString;
1176var
1177 n, i: Integer;
1178 c: AnsiChar;
1179 s, t: AnsiString;
1180 shift: AnsiChar;
1181 table: String;
1182begin
1183 Result := '';
1184 n := 1;
1185 if modified then
1186 begin
1187 shift := '&';
1188 table := TableBase64mod;
1189 end
1190 else
1191 begin
1192 shift := '+';
1193 table := TableBase64;
1194 end;
1195 while Length(Value) >= n do
1196 begin
1197 c := Value[n];
1198 Inc(n);
1199 if c <> shift then
1200 Result := Result + WriteMulti(Ord(c), 0, 0, 0, 2, false)
1201 else
1202 begin
1203 s := '';
1204 while Length(Value) >= n do
1205 begin
1206 c := Value[n];
1207 Inc(n);
1208 if c = '-' then
1209 Break;
1210 if (c = '=') or (Pos(c, table) < 1) then
1211 begin
1212 Dec(n);
1213 Break;
1214 end;
1215 s := s + c;
1216 end;
1217 if s = '' then
1218 s := WriteMulti(Ord(shift), 0, 0, 0, 2, false)
1219 else
1220 begin
1221 if modified then
1222 t := DecodeBase64mod(s)
1223 else
1224 t := DecodeBase64(s);
1225 if not odd(length(t)) then
1226 s := t
1227 else
1228 begin //ill-formed sequence
1229 t := s;
1230 s := WriteMulti(Ord(shift), 0, 0, 0, 2, false);
1231 for i := 1 to length(t) do
1232 s := s + WriteMulti(Ord(t[i]), 0, 0, 0, 2, false);
1233 end;
1234 end;
1235 Result := Result + s;
1236 end;
1237 end;
1238end;
1239
1240{==============================================================================}
1241function UCS2toUTF7(const Value: AnsiString; Modified: Boolean): AnsiString;
1242var
1243 s: AnsiString;
1244 b1, b2, b3, b4: Byte;
1245 n, m: Integer;
1246 shift: AnsiChar;
1247begin
1248 Result := '';
1249 n := 1;
1250 if modified then
1251 shift := '&'
1252 else
1253 shift := '+';
1254 while Length(Value) >= n do
1255 begin
1256 ReadMulti(Value, n, 2, b1, b2, b3, b4, false);
1257 if (b2 = 0) and (b1 < 128) then
1258 if AnsiChar(b1) = shift then
1259 Result := Result + shift + '-'
1260 else
1261 Result := Result + AnsiChar(b1)
1262 else
1263 begin
1264 s := AnsiChar(b2) + AnsiChar(b1);
1265 while Length(Value) >= n do
1266 begin
1267 ReadMulti(Value, n, 2, b1, b2, b3, b4, false);
1268 if (b2 = 0) and (b1 < 128) then
1269 begin
1270 Dec(n, 2);
1271 Break;
1272 end;
1273 s := s + AnsiChar(b2) + AnsiChar(b1);
1274 end;
1275 if modified then
1276 s := EncodeBase64mod(s)
1277 else
1278 s := EncodeBase64(s);
1279 m := Pos('=', s);
1280 if m > 0 then
1281 s := Copy(s, 1, m - 1);
1282 Result := Result + shift + s + '-';
1283 end;
1284 end;
1285end;
1286
1287{==============================================================================}
1288function CharsetConversion(const Value: AnsiString; CharFrom: TMimeChar;
1289 CharTo: TMimeChar): AnsiString;
1290begin
1291 Result := CharsetConversionEx(Value, CharFrom, CharTo, Replace_None);
1292end;
1293
1294{==============================================================================}
1295function CharsetConversionEx(const Value: AnsiString; CharFrom: TMimeChar;
1296 CharTo: TMimeChar; const TransformTable: array of Word): AnsiString;
1297begin
1298 Result := CharsetConversionTrans(Value, CharFrom, CharTo, TransformTable, True);
1299end;
1300
1301{==============================================================================}
1302
1303function InternalToUcs(const Value: AnsiString; Charfrom: TMimeChar): AnsiString;
1304var
1305 uni: Word;
1306 n: Integer;
1307 b1, b2, b3, b4: Byte;
1308 SourceTable: array[128..255] of Word;
1309 mbf: Byte;
1310 lef: Boolean;
1311 s: AnsiString;
1312begin
1313 if CharFrom = UTF_8 then
1314 s := UTF8toUCS4(Value)
1315 else
1316 if CharFrom = UTF_7 then
1317 s := UTF7toUCS2(Value, False)
1318 else
1319 if CharFrom = UTF_7mod then
1320 s := UTF7toUCS2(Value, True)
1321 else
1322 s := Value;
1323 GetArray(CharFrom, SourceTable);
1324 mbf := 1;
1325 if CharFrom in SetTwo then
1326 mbf := 2;
1327 if CharFrom in SetFour then
1328 mbf := 4;
1329 lef := CharFrom in SetLe;
1330 Result := '';
1331 n := 1;
1332 while Length(s) >= n do
1333 begin
1334 ReadMulti(s, n, mbf, b1, b2, b3, b4, lef);
1335 //handle BOM
1336 if (b3 = 0) and (b4 = 0) then
1337 begin
1338 if (b1 = $FE) and (b2 = $FF) then
1339 begin
1340 lef := not lef;
1341 continue;
1342 end;
1343 if (b1 = $FF) and (b2 = $FE) then
1344 continue;
1345 end;
1346 if mbf = 1 then
1347 if b1 > 127 then
1348 begin
1349 uni := SourceTable[b1];
1350 b1 := Lo(uni);
1351 b2 := Hi(uni);
1352 end;
1353 Result := Result + WriteMulti(b1, b2, b3, b4, 2, False);
1354 end;
1355end;
1356
1357function CharsetConversionTrans(Value: AnsiString; CharFrom: TMimeChar;
1358 CharTo: TMimeChar; const TransformTable: array of Word; Translit: Boolean): AnsiString;
1359var
1360 uni: Word;
1361 n, m: Integer;
1362 b: Byte;
1363 b1, b2, b3, b4: Byte;
1364 TargetTable: array[128..255] of Word;
1365 mbt: Byte;
1366 let: Boolean;
1367 ucsstring, s, t: AnsiString;
1368 cd: iconv_t;
1369 f: Boolean;
1370 NotNeedTransform: Boolean;
1371 FromID, ToID: string;
1372begin
1373 NotNeedTransform := (High(TransformTable) = 0);
1374 if (CharFrom = CharTo) and NotNeedTransform then
1375 begin
1376 Result := Value;
1377 Exit;
1378 end;
1379 FromID := GetIDFromCP(CharFrom);
1380 ToID := GetIDFromCP(CharTo);
1381 cd := Iconv_t(-1);
1382 //do two-pass conversion. Transform to UCS-2 first.
1383 if not DisableIconv then
1384 cd := SynaIconvOpenIgnore('UCS-2BE', FromID);
1385 try
1386 if cd <> iconv_t(-1) then
1387 SynaIconv(cd, Value, ucsstring)
1388 else
1389 ucsstring := InternalToUcs(Value, CharFrom);
1390 finally
1391 SynaIconvClose(cd);
1392 end;
1393 //here we allways have ucstring with UCS-2 encoding
1394 //second pass... from UCS-2 to target encoding.
1395 if not DisableIconv then
1396 if translit then
1397 cd := SynaIconvOpenTranslit(ToID, 'UCS-2BE')
1398 else
1399 cd := SynaIconvOpenIgnore(ToID, 'UCS-2BE');
1400 try
1401 if (cd <> iconv_t(-1)) and NotNeedTransform then
1402 begin
1403 if CharTo = UTF_7 then
1404 ucsstring := ucsstring + #0 + '-';
1405 //when transformtable is not needed and Iconv know target charset,
1406 //do it fast by one call.
1407 SynaIconv(cd, ucsstring, Result);
1408 if CharTo = UTF_7 then
1409 Delete(Result, Length(Result), 1);
1410 end
1411 else
1412 begin
1413 GetArray(CharTo, TargetTable);
1414 mbt := 1;
1415 if CharTo in SetTwo then
1416 mbt := 2;
1417 if CharTo in SetFour then
1418 mbt := 4;
1419 let := CharTo in SetLe;
1420 b3 := 0;
1421 b4 := 0;
1422 Result := '';
1423 for n:= 0 to (Length(ucsstring) div 2) - 1 do
1424 begin
1425 s := Copy(ucsstring, n * 2 + 1, 2);
1426 b2 := Ord(s[1]);
1427 b1 := Ord(s[2]);
1428 uni := b2 * 256 + b1;
1429 if not NotNeedTransform then
1430 begin
1431 uni := ReplaceUnicode(uni, TransformTable);
1432 b1 := Lo(uni);
1433 b2 := Hi(uni);
1434 s[1] := AnsiChar(b2);
1435 s[2] := AnsiChar(b1);
1436 end;
1437 if cd <> iconv_t(-1) then
1438 begin
1439 if CharTo = UTF_7 then
1440 s := s + #0 + '-';
1441 SynaIconv(cd, s, t);
1442 if CharTo = UTF_7 then
1443 Delete(t, Length(t), 1);
1444 Result := Result + t;
1445 end
1446 else
1447 begin
1448 f := True;
1449 if mbt = 1 then
1450 if uni > 127 then
1451 begin
1452 f := False;
1453 b := 0;
1454 for m := 128 to 255 do
1455 if TargetTable[m] = uni then
1456 begin
1457 b := m;
1458 f := True;
1459 Break;
1460 end;
1461 b1 := b;
1462 b2 := 0;
1463 end
1464 else
1465 b1 := Lo(uni);
1466 if not f then
1467 if translit then
1468 begin
1469 b1 := Ord(NotFoundChar);
1470 b2 := 0;
1471 f := True;
1472 end;
1473 if f then
1474 Result := Result + WriteMulti(b1, b2, b3, b4, mbt, let)
1475 end;
1476 end;
1477 if cd = iconv_t(-1) then
1478 begin
1479 if CharTo = UTF_7 then
1480 Result := UCS2toUTF7(Result, false);
1481 if CharTo = UTF_7mod then
1482 Result := UCS2toUTF7(Result, true);
1483 if CharTo = UTF_8 then
1484 Result := UCS4toUTF8(Result);
1485 end;
1486 end;
1487 finally
1488 SynaIconvClose(cd);
1489 end;
1490end;
1491
1492{==============================================================================}
1493{$IFNDEF WIN32}
1494
1495function GetCurCP: TMimeChar;
1496begin
1497 {$IFNDEF FPC}
1498 Result := GetCPFromID(nl_langinfo(_NL_CTYPE_CODESET_NAME));
1499 {$ELSE}
1500 {$IFDEF FPC_USE_LIBC}
1501 Result := GetCPFromID(nl_langinfo(_NL_CTYPE_CODESET_NAME));
1502 {$ELSE}
1503 //How to get system codepage without LIBC?
1504 Result := UTF_8;
1505 {$ENDIF}
1506 {$ENDIF}
1507end;
1508
1509function GetCurOEMCP: TMimeChar;
1510begin
1511 Result := GetCurCP;
1512end;
1513
1514{$ELSE}
1515
1516function CPToMimeChar(Value: Integer): TMimeChar;
1517begin
1518 case Value of
1519 437, 850, 20127:
1520 Result := ISO_8859_1; //I know, it is not ideal!
1521 737:
1522 Result := CP737;
1523 775:
1524 Result := CP775;
1525 852:
1526 Result := CP852;
1527 855:
1528 Result := CP855;
1529 857:
1530 Result := CP857;
1531 858:
1532 Result := CP858;
1533 860:
1534 Result := CP860;
1535 861:
1536 Result := CP861;
1537 862:
1538 Result := CP862;
1539 863:
1540 Result := CP863;
1541 864:
1542 Result := CP864;
1543 865:
1544 Result := CP865;
1545 866:
1546 Result := CP866;
1547 869:
1548 Result := CP869;
1549 874:
1550 Result := ISO_8859_15;
1551 895:
1552 Result := CP895;
1553 932:
1554 Result := CP932;
1555 936:
1556 Result := CP936;
1557 949:
1558 Result := CP949;
1559 950:
1560 Result := CP950;
1561 1200:
1562 Result := UCS_2LE;
1563 1201:
1564 Result := UCS_2;
1565 1250:
1566 Result := CP1250;
1567 1251:
1568 Result := CP1251;
1569 1253:
1570 Result := CP1253;
1571 1254:
1572 Result := CP1254;
1573 1255:
1574 Result := CP1255;
1575 1256:
1576 Result := CP1256;
1577 1257:
1578 Result := CP1257;
1579 1258:
1580 Result := CP1258;
1581 1361:
1582 Result := CP1361;
1583 10000:
1584 Result := MAC;
1585 10004:
1586 Result := MACAR;
1587 10005:
1588 Result := MACHEB;
1589 10006:
1590 Result := MACGR;
1591 10007:
1592 Result := MACCYR;
1593 10010:
1594 Result := MACRO;
1595 10017:
1596 Result := MACUK;
1597 10021:
1598 Result := MACTH;
1599 10029:
1600 Result := MACCE;
1601 10079:
1602 Result := MACICE;
1603 10081:
1604 Result := MACTU;
1605 10082:
1606 Result := MACCRO;
1607 12000:
1608 Result := UCS_4LE;
1609 12001:
1610 Result := UCS_4;
1611 20866:
1612 Result := KOI8_R;
1613 20932:
1614 Result := JIS_X0208;
1615 20936:
1616 Result := GB2312;
1617 21866:
1618 Result := KOI8_U;
1619 28591:
1620 Result := ISO_8859_1;
1621 28592:
1622 Result := ISO_8859_2;
1623 28593:
1624 Result := ISO_8859_3;
1625 28594:
1626 Result := ISO_8859_4;
1627 28595:
1628 Result := ISO_8859_5;
1629 28596, 708:
1630 Result := ISO_8859_6;
1631 28597:
1632 Result := ISO_8859_7;
1633 28598, 38598:
1634 Result := ISO_8859_8;
1635 28599:
1636 Result := ISO_8859_9;
1637 28605:
1638 Result := ISO_8859_15;
1639 50220:
1640 Result := ISO_2022_JP; //? ISO 2022 Japanese with no halfwidth Katakana
1641 50221:
1642 Result := ISO_2022_JP1;//? Japanese with halfwidth Katakana
1643 50222:
1644 Result := ISO_2022_JP2;//? Japanese JIS X 0201-1989
1645 50225:
1646 Result := ISO_2022_KR;
1647 50227:
1648 Result := ISO_2022_CN;//? ISO 2022 Simplified Chinese
1649 50229:
1650 Result := ISO_2022_CNE;//? ISO 2022 Traditional Chinese
1651 51932:
1652 Result := EUC_JP;
1653 51936:
1654 Result := GB2312;
1655 51949:
1656 Result := EUC_KR;
1657 52936:
1658 Result := HZ;
1659 54936:
1660 Result := GB18030;
1661 65000:
1662 Result := UTF_7;
1663 65001:
1664 Result := UTF_8;
1665 0:
1666 Result := UCS_2LE;
1667 else
1668 Result := CP1252;
1669 end;
1670end;
1671
1672function GetCurCP: TMimeChar;
1673begin
1674 Result := CPToMimeChar(GetACP);
1675end;
1676
1677function GetCurOEMCP: TMimeChar;
1678begin
1679 Result := CPToMimeChar(GetOEMCP);
1680end;
1681{$ENDIF}
1682
1683{==============================================================================}
1684function NeedCharsetConversion(const Value: AnsiString): Boolean;
1685var
1686 n: Integer;
1687begin
1688 Result := False;
1689 for n := 1 to Length(Value) do
1690 if (Ord(Value[n]) > 127) or (Ord(Value[n]) = 0) then
1691 begin
1692 Result := True;
1693 Break;
1694 end;
1695end;
1696
1697{==============================================================================}
1698function IdealCharsetCoding(const Value: AnsiString; CharFrom: TMimeChar;
1699 CharTo: TMimeSetChar): TMimeChar;
1700var
1701 n: Integer;
1702 max: Integer;
1703 s, t, u: AnsiString;
1704 CharSet: TMimeChar;
1705begin
1706 Result := ISO_8859_1;
1707 s := Copy(Value, 1, 1024); //max first 1KB for next procedure
1708 max := 0;
1709 for n := Ord(Low(TMimeChar)) to Ord(High(TMimeChar)) do
1710 begin
1711 CharSet := TMimeChar(n);
1712 if CharSet in CharTo then
1713 begin
1714 t := CharsetConversionTrans(s, CharFrom, CharSet, Replace_None, False);
1715 u := CharsetConversionTrans(t, CharSet, CharFrom, Replace_None, False);
1716 if s = u then
1717 begin
1718 Result := CharSet;
1719 Exit;
1720 end;
1721 if Length(u) > max then
1722 begin
1723 Result := CharSet;
1724 max := Length(u);
1725 end;
1726 end;
1727 end;
1728end;
1729
1730{==============================================================================}
1731function GetBOM(Value: TMimeChar): AnsiString;
1732begin
1733 Result := '';
1734 case Value of
1735 UCS_2:
1736 Result := #$fe + #$ff;
1737 UCS_4:
1738 Result := #$00 + #$00 + #$fe + #$ff;
1739 UCS_2LE:
1740 Result := #$ff + #$fe;
1741 UCS_4LE:
1742 Result := #$ff + #$fe + #$00 + #$00;
1743 UTF_8:
1744 Result := #$ef + #$bb + #$bf;
1745 end;
1746end;
1747
1748{==============================================================================}
1749function GetCPFromID(Value: AnsiString): TMimeChar;
1750begin
1751 Value := UpperCase(Value);
1752 if (Pos('KAMENICKY', Value) > 0) or (Pos('895', Value) > 0) then
1753 Result := CP895
1754 else
1755 if Pos('MUTF-7', Value) > 0 then
1756 Result := UTF_7mod
1757 else
1758 Result := GetCPFromIconvID(Value);
1759end;
1760
1761{==============================================================================}
1762function GetIDFromCP(Value: TMimeChar): AnsiString;
1763begin
1764 case Value of
1765 CP895:
1766 Result := 'CP-895';
1767 UTF_7mod:
1768 Result := 'mUTF-7';
1769 else
1770 Result := GetIconvIDFromCP(Value);
1771 end;
1772end;
1773
1774{==============================================================================}
1775function StringToWide(const Value: AnsiString): WideString;
1776var
1777 n: integer;
1778 x, y: integer;
1779begin
1780 SetLength(Result, Length(Value) div 2);
1781 for n := 1 to Length(Value) div 2 do
1782 begin
1783 x := Ord(Value[((n-1) * 2) + 1]);
1784 y := Ord(Value[((n-1) * 2) + 2]);
1785 Result[n] := WideChar(x * 256 + y);
1786 end;
1787end;
1788
1789{==============================================================================}
1790function WideToString(const Value: WideString): AnsiString;
1791var
1792 n: integer;
1793 x: integer;
1794begin
1795 SetLength(Result, Length(Value) * 2);
1796 for n := 1 to Length(Value) do
1797 begin
1798 x := Ord(Value[n]);
1799 Result[((n-1) * 2) + 1] := AnsiChar(x div 256);
1800 Result[((n-1) * 2) + 2] := AnsiChar(x mod 256);
1801 end;
1802end;
1803
1804{==============================================================================}
1805initialization
1806begin
1807 IconvArr[0].Charset := ISO_8859_1;
1808 IconvArr[0].Charname := 'ISO-8859-1 CP819 IBM819 ISO-IR-100 ISO8859-1 ISO_8859-1 ISO_8859-1:1987 L1 LATIN1 CSISOLATIN1';
1809 IconvArr[1].Charset := UTF_8;
1810 IconvArr[1].Charname := 'UTF-8';
1811 IconvArr[2].Charset := UCS_2;
1812 IconvArr[2].Charname := 'ISO-10646-UCS-2 UCS-2 CSUNICODE';
1813 IconvArr[3].Charset := UCS_2;
1814 IconvArr[3].Charname := 'UCS-2BE UNICODE-1-1 UNICODEBIG CSUNICODE11';
1815 IconvArr[4].Charset := UCS_2LE;
1816 IconvArr[4].Charname := 'UCS-2LE UNICODELITTLE';
1817 IconvArr[5].Charset := UCS_4;
1818 IconvArr[5].Charname := 'ISO-10646-UCS-4 UCS-4 CSUCS4';
1819 IconvArr[6].Charset := UCS_4;
1820 IconvArr[6].Charname := 'UCS-4BE';
1821 IconvArr[7].Charset := UCS_2LE;
1822 IconvArr[7].Charname := 'UCS-4LE';
1823 IconvArr[8].Charset := UTF_16;
1824 IconvArr[8].Charname := 'UTF-16';
1825 IconvArr[9].Charset := UTF_16;
1826 IconvArr[9].Charname := 'UTF-16BE';
1827 IconvArr[10].Charset := UTF_16LE;
1828 IconvArr[10].Charname := 'UTF-16LE';
1829 IconvArr[11].Charset := UTF_32;
1830 IconvArr[11].Charname := 'UTF-32';
1831 IconvArr[12].Charset := UTF_32;
1832 IconvArr[12].Charname := 'UTF-32BE';
1833 IconvArr[13].Charset := UTF_32;
1834 IconvArr[13].Charname := 'UTF-32LE';
1835 IconvArr[14].Charset := UTF_7;
1836 IconvArr[14].Charname := 'UNICODE-1-1-UTF-7 UTF-7 CSUNICODE11UTF7';
1837 IconvArr[15].Charset := C99;
1838 IconvArr[15].Charname := 'C99';
1839 IconvArr[16].Charset := JAVA;
1840 IconvArr[16].Charname := 'JAVA';
1841 IconvArr[17].Charset := ISO_8859_1;
1842 IconvArr[17].Charname := 'US-ASCII ANSI_X3.4-1968 ANSI_X3.4-1986 ASCII CP367 IBM367 ISO-IR-6 ISO646-US ISO_646.IRV:1991 US CSASCII';
1843 IconvArr[18].Charset := ISO_8859_2;
1844 IconvArr[18].Charname := 'ISO-8859-2 ISO-IR-101 ISO8859-2 ISO_8859-2 ISO_8859-2:1987 L2 LATIN2 CSISOLATIN2';
1845 IconvArr[19].Charset := ISO_8859_3;
1846 IconvArr[19].Charname := 'ISO-8859-3 ISO-IR-109 ISO8859-3 ISO_8859-3 ISO_8859-3:1988 L3 LATIN3 CSISOLATIN3';
1847 IconvArr[20].Charset := ISO_8859_4;
1848 IconvArr[20].Charname := 'ISO-8859-4 ISO-IR-110 ISO8859-4 ISO_8859-4 ISO_8859-4:1988 L4 LATIN4 CSISOLATIN4';
1849 IconvArr[21].Charset := ISO_8859_5;
1850 IconvArr[21].Charname := 'ISO-8859-5 CYRILLIC ISO-IR-144 ISO8859-5 ISO_8859-5 ISO_8859-5:1988 CSISOLATINCYRILLIC';
1851 IconvArr[22].Charset := ISO_8859_6;
1852 IconvArr[22].Charname := 'ISO-8859-6 ARABIC ASMO-708 ECMA-114 ISO-IR-127 ISO8859-6 ISO_8859-6 ISO_8859-6:1987 CSISOLATINARABIC';
1853 IconvArr[23].Charset := ISO_8859_7;
1854 IconvArr[23].Charname := 'ISO-8859-7 ECMA-118 ELOT_928 GREEK GREEK8 ISO-IR-126 ISO8859-7 ISO_8859-7 ISO_8859-7:1987 CSISOLATINGREEK';
1855 IconvArr[24].Charset := ISO_8859_8;
1856 IconvArr[24].Charname := 'ISO-8859-8 HEBREW ISO_8859-8 ISO-IR-138 ISO8859-8 ISO_8859-8:1988 CSISOLATINHEBREW ISO-8859-8-I';
1857 IconvArr[25].Charset := ISO_8859_9;
1858 IconvArr[25].Charname := 'ISO-8859-9 ISO-IR-148 ISO8859-9 ISO_8859-9 ISO_8859-9:1989 L5 LATIN5 CSISOLATIN5';
1859 IconvArr[26].Charset := ISO_8859_10;
1860 IconvArr[26].Charname := 'ISO-8859-10 ISO-IR-157 ISO8859-10 ISO_8859-10 ISO_8859-10:1992 L6 LATIN6 CSISOLATIN6';
1861 IconvArr[27].Charset := ISO_8859_13;
1862 IconvArr[27].Charname := 'ISO-8859-13 ISO-IR-179 ISO8859-13 ISO_8859-13 L7 LATIN7';
1863 IconvArr[28].Charset := ISO_8859_14;
1864 IconvArr[28].Charname := 'ISO-8859-14 ISO-CELTIC ISO-IR-199 ISO8859-14 ISO_8859-14 ISO_8859-14:1998 L8 LATIN8';
1865 IconvArr[29].Charset := ISO_8859_15;
1866 IconvArr[29].Charname := 'ISO-8859-15 ISO-IR-203 ISO8859-15 ISO_8859-15 ISO_8859-15:1998';
1867 IconvArr[30].Charset := ISO_8859_16;
1868 IconvArr[30].Charname := 'ISO-8859-16 ISO-IR-226 ISO8859-16 ISO_8859-16 ISO_8859-16:2000';
1869 IconvArr[31].Charset := KOI8_R;
1870 IconvArr[31].Charname := 'KOI8-R CSKOI8R';
1871 IconvArr[32].Charset := KOI8_U;
1872 IconvArr[32].Charname := 'KOI8-U';
1873 IconvArr[33].Charset := KOI8_RU;
1874 IconvArr[33].Charname := 'KOI8-RU';
1875 IconvArr[34].Charset := CP1250;
1876 IconvArr[34].Charname := 'WINDOWS-1250 CP1250 MS-EE';
1877 IconvArr[35].Charset := CP1251;
1878 IconvArr[35].Charname := 'WINDOWS-1251 CP1251 MS-CYRL';
1879 IconvArr[36].Charset := CP1252;
1880 IconvArr[36].Charname := 'WINDOWS-1252 CP1252 MS-ANSI';
1881 IconvArr[37].Charset := CP1253;
1882 IconvArr[37].Charname := 'WINDOWS-1253 CP1253 MS-GREEK';
1883 IconvArr[38].Charset := CP1254;
1884 IconvArr[38].Charname := 'WINDOWS-1254 CP1254 MS-TURK';
1885 IconvArr[39].Charset := CP1255;
1886 IconvArr[39].Charname := 'WINDOWS-1255 CP1255 MS-HEBR';
1887 IconvArr[40].Charset := CP1256;
1888 IconvArr[40].Charname := 'WINDOWS-1256 CP1256 MS-ARAB';
1889 IconvArr[41].Charset := CP1257;
1890 IconvArr[41].Charname := 'WINDOWS-1257 CP1257 WINBALTRIM';
1891 IconvArr[42].Charset := CP1258;
1892 IconvArr[42].Charname := 'WINDOWS-1258 CP1258';
1893 IconvArr[43].Charset := ISO_8859_1;
1894 IconvArr[43].Charname := '850 CP850 IBM850 CSPC850MULTILINGUAL';
1895 IconvArr[44].Charset := CP862;
1896 IconvArr[44].Charname := '862 CP862 IBM862 CSPC862LATINHEBREW';
1897 IconvArr[45].Charset := CP866;
1898 IconvArr[45].Charname := '866 CP866 IBM866 CSIBM866';
1899 IconvArr[46].Charset := MAC;
1900 IconvArr[46].Charname := 'MAC MACINTOSH MACROMAN CSMACINTOSH';
1901 IconvArr[47].Charset := MACCE;
1902 IconvArr[47].Charname := 'MACCENTRALEUROPE';
1903 IconvArr[48].Charset := MACICE;
1904 IconvArr[48].Charname := 'MACICELAND';
1905 IconvArr[49].Charset := MACCRO;
1906 IconvArr[49].Charname := 'MACCROATIAN';
1907 IconvArr[50].Charset := MACRO;
1908 IconvArr[50].Charname := 'MACROMANIA';
1909 IconvArr[51].Charset := MACCYR;
1910 IconvArr[51].Charname := 'MACCYRILLIC';
1911 IconvArr[52].Charset := MACUK;
1912 IconvArr[52].Charname := 'MACUKRAINE';
1913 IconvArr[53].Charset := MACGR;
1914 IconvArr[53].Charname := 'MACGREEK';
1915 IconvArr[54].Charset := MACTU;
1916 IconvArr[54].Charname := 'MACTURKISH';
1917 IconvArr[55].Charset := MACHEB;
1918 IconvArr[55].Charname := 'MACHEBREW';
1919 IconvArr[56].Charset := MACAR;
1920 IconvArr[56].Charname := 'MACARABIC';
1921 IconvArr[57].Charset := MACTH;
1922 IconvArr[57].Charname := 'MACTHAI';
1923 IconvArr[58].Charset := ROMAN8;
1924 IconvArr[58].Charname := 'HP-ROMAN8 R8 ROMAN8 CSHPROMAN8';
1925 IconvArr[59].Charset := NEXTSTEP;
1926 IconvArr[59].Charname := 'NEXTSTEP';
1927 IconvArr[60].Charset := ARMASCII;
1928 IconvArr[60].Charname := 'ARMSCII-8';
1929 IconvArr[61].Charset := GEORGIAN_AC;
1930 IconvArr[61].Charname := 'GEORGIAN-ACADEMY';
1931 IconvArr[62].Charset := GEORGIAN_PS;
1932 IconvArr[62].Charname := 'GEORGIAN-PS';
1933 IconvArr[63].Charset := KOI8_T;
1934 IconvArr[63].Charname := 'KOI8-T';
1935 IconvArr[64].Charset := MULELAO;
1936 IconvArr[64].Charname := 'MULELAO-1';
1937 IconvArr[65].Charset := CP1133;
1938 IconvArr[65].Charname := 'CP1133 IBM-CP1133';
1939 IconvArr[66].Charset := TIS620;
1940 IconvArr[66].Charname := 'TIS-620 ISO-IR-166 TIS620 TIS620-0 TIS620.2529-1 TIS620.2533-0 TIS620.2533-1';
1941 IconvArr[67].Charset := CP874;
1942 IconvArr[67].Charname := 'CP874 WINDOWS-874';
1943 IconvArr[68].Charset := VISCII;
1944 IconvArr[68].Charname := 'VISCII VISCII1.1-1 CSVISCII';
1945 IconvArr[69].Charset := TCVN;
1946 IconvArr[69].Charname := 'TCVN TCVN-5712 TCVN5712-1 TCVN5712-1:1993';
1947 IconvArr[70].Charset := ISO_IR_14;
1948 IconvArr[70].Charname := 'ISO-IR-14 ISO646-JP JIS_C6220-1969-RO JP CSISO14JISC6220RO';
1949 IconvArr[71].Charset := JIS_X0201;
1950 IconvArr[71].Charname := 'JISX0201-1976 JIS_X0201 X0201 CSHALFWIDTHKATAKANA';
1951 IconvArr[72].Charset := JIS_X0208;
1952 IconvArr[72].Charname := 'ISO-IR-87 JIS0208 JIS_C6226-1983 JIS_X0208 JIS_X0208-1983 JIS_X0208-1990 X0208 CSISO87JISX0208';
1953 IconvArr[73].Charset := JIS_X0212;
1954 IconvArr[73].Charname := 'ISO-IR-159 JIS_X0212 JIS_X0212-1990 JIS_X0212.1990-0 X0212 CSISO159JISX02121990';
1955 IconvArr[74].Charset := GB1988_80;
1956 IconvArr[74].Charname := 'CN GB_1988-80 ISO-IR-57 ISO646-CN CSISO57GB1988';
1957 IconvArr[75].Charset := GB2312_80;
1958 IconvArr[75].Charname := 'CHINESE GB_2312-80 ISO-IR-58 CSISO58GB231280';
1959 IconvArr[76].Charset := ISO_IR_165;
1960 IconvArr[76].Charname := 'CN-GB-ISOIR165 ISO-IR-165';
1961 IconvArr[77].Charset := ISO_IR_149;
1962 IconvArr[77].Charname := 'ISO-IR-149 KOREAN KSC_5601 KS_C_5601-1987 KS_C_5601-1989 CSKSC56011987';
1963 IconvArr[78].Charset := EUC_JP;
1964 IconvArr[78].Charname := 'EUC-JP EUCJP EXTENDED_UNIX_CODE_PACKED_FORMAT_FOR_JAPANESE CSEUCPKDFMTJAPANESE';
1965 IconvArr[79].Charset := SHIFT_JIS;
1966 IconvArr[79].Charname := 'SHIFT-JIS MS_KANJI SHIFT_JIS SJIS CSSHIFTJIS';
1967 IconvArr[80].Charset := CP932;
1968 IconvArr[80].Charname := 'CP932';
1969 IconvArr[81].Charset := ISO_2022_JP;
1970 IconvArr[81].Charname := 'ISO-2022-JP CSISO2022JP';
1971 IconvArr[82].Charset := ISO_2022_JP1;
1972 IconvArr[82].Charname := 'ISO-2022-JP-1';
1973 IconvArr[83].Charset := ISO_2022_JP2;
1974 IconvArr[83].Charname := 'ISO-2022-JP-2 CSISO2022JP2';
1975 IconvArr[84].Charset := GB2312;
1976 IconvArr[84].Charname := 'CN-GB EUC-CN EUCCN GB2312 CSGB2312';
1977 IconvArr[85].Charset := CP936;
1978 IconvArr[85].Charname := 'CP936 GBK';
1979 IconvArr[86].Charset := GB18030;
1980 IconvArr[86].Charname := 'GB18030';
1981 IconvArr[87].Charset := ISO_2022_CN;
1982 IconvArr[87].Charname := 'ISO-2022-CN CSISO2022CN';
1983 IconvArr[88].Charset := ISO_2022_CNE;
1984 IconvArr[88].Charname := 'ISO-2022-CN-EXT';
1985 IconvArr[89].Charset := HZ;
1986 IconvArr[89].Charname := 'HZ HZ-GB-2312';
1987 IconvArr[90].Charset := EUC_TW;
1988 IconvArr[90].Charname := 'EUC-TW EUCTW CSEUCTW';
1989 IconvArr[91].Charset := BIG5;
1990 IconvArr[91].Charname := 'BIG5 BIG-5 BIG-FIVE BIGFIVE CN-BIG5 CSBIG5';
1991 IconvArr[92].Charset := CP950;
1992 IconvArr[92].Charname := 'CP950';
1993 IconvArr[93].Charset := BIG5_HKSCS;
1994 IconvArr[93].Charname := 'BIG5-HKSCS BIG5HKSCS';
1995 IconvArr[94].Charset := EUC_KR;
1996 IconvArr[94].Charname := 'EUC-KR EUCKR CSEUCKR';
1997 IconvArr[95].Charset := CP949;
1998 IconvArr[95].Charname := 'CP949 UHC';
1999 IconvArr[96].Charset := CP1361;
2000 IconvArr[96].Charname := 'CP1361 JOHAB';
2001 IconvArr[97].Charset := ISO_2022_KR;
2002 IconvArr[97].Charname := 'ISO-2022-KR CSISO2022KR';
2003 IconvArr[98].Charset := ISO_8859_1;
2004 IconvArr[98].Charname := '437 CP437 IBM437 CSPC8CODEPAGE437';
2005 IconvArr[99].Charset := CP737;
2006 IconvArr[99].Charname := 'CP737';
2007 IconvArr[100].Charset := CP775;
2008 IconvArr[100].Charname := 'CP775 IBM775 CSPC775BALTIC';
2009 IconvArr[101].Charset := CP852;
2010 IconvArr[101].Charname := '852 CP852 IBM852 CSPCP852';
2011 IconvArr[102].Charset := CP853;
2012 IconvArr[102].Charname := 'CP853';
2013 IconvArr[103].Charset := CP855;
2014 IconvArr[103].Charname := '855 CP855 IBM855 CSIBM855';
2015 IconvArr[104].Charset := CP857;
2016 IconvArr[104].Charname := '857 CP857 IBM857 CSIBM857';
2017 IconvArr[105].Charset := CP858;
2018 IconvArr[105].Charname := 'CP858';
2019 IconvArr[106].Charset := CP860;
2020 IconvArr[106].Charname := '860 CP860 IBM860 CSIBM860';
2021 IconvArr[107].Charset := CP861;
2022 IconvArr[107].Charname := '861 CP-IS CP861 IBM861 CSIBM861';
2023 IconvArr[108].Charset := CP863;
2024 IconvArr[108].Charname := '863 CP863 IBM863 CSIBM863';
2025 IconvArr[109].Charset := CP864;
2026 IconvArr[109].Charname := 'CP864 IBM864 CSIBM864';
2027 IconvArr[110].Charset := CP865;
2028 IconvArr[110].Charname := '865 CP865 IBM865 CSIBM865';
2029 IconvArr[111].Charset := CP869;
2030 IconvArr[111].Charname := '869 CP-GR CP869 IBM869 CSIBM869';
2031 IconvArr[112].Charset := CP1125;
2032 IconvArr[112].Charname := 'CP1125';
2033end;
2034
2035end.
Note: See TracBrowser for help on using the repository browser.