source: Network/synapse/synachar.pas

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