~ubuntu-branches/ubuntu/saucy/lazarus/saucy

« back to all changes in this revision

Viewing changes to lcl/lconvencoding.pas

  • Committer: Package Import Robot
  • Author(s): Paul Gevers, Abou Al Montacir, Bart Martens, Paul Gevers
  • Date: 2013-06-08 14:12:17 UTC
  • mfrom: (1.1.9)
  • Revision ID: package-import@ubuntu.com-20130608141217-7k0cy9id8ifcnutc
Tags: 1.0.8+dfsg-1
[ Abou Al Montacir ]
* New upstream major release and multiple maintenace release offering many
  fixes and new features marking a new milestone for the Lazarus development
  and its stability level.
  - The detailed list of changes can be found here:
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_release_notes
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_fixes_branch
* LCL changes:
  - LCL is now a normal package.
      + Platform independent parts of the LCL are now in the package LCLBase
      + LCL is automatically recompiled when switching the target platform,
        unless pre-compiled binaries for this target are already installed.
      + No impact on existing projects.
      + Linker options needed by LCL are no more added to projects that do
        not use the LCL package.
  - Minor changes in LCL basic classes behaviour
      + TCustomForm.Create raises an exception if a form resource is not
        found.
      + TNotebook and TPage: a new implementation of these classes was added.
      + TDBNavigator: It is now possible to have focusable buttons by setting
        Options = [navFocusableButtons] and TabStop = True, useful for
        accessibility and for devices with neither mouse nor touch screen.
      + Names of TControlBorderSpacing.GetSideSpace and GetSpace were swapped
        and are now consistent. GetSideSpace = Around + GetSpace.
      + TForm.WindowState=wsFullscreen was added
      + TCanvas.TextFitInfo was added to calculate how many characters will
        fit into a specified Width. Useful for word-wrapping calculations.
      + TControl.GetColorResolvingParent and
        TControl.GetRGBColorResolvingParent were added, simplifying the work
        to obtain the final color of the control while resolving clDefault
        and the ParentColor.
      + LCLIntf.GetTextExtentExPoint now has a good default implementation
        which works in any platform not providing a specific implementation.
        However, Widgetset specific implementation is better, when available.
      + TTabControl was reorganized. Now it has the correct class hierarchy
        and inherits from TCustomTabControl as it should.
  - New unit in the LCL:
      + lazdialogs.pas: adds non-native versions of various native dialogs,
        for example TLazOpenDialog, TLazSaveDialog, TLazSelectDirectoryDialog.
        It is used by widgetsets which either do not have a native dialog, or
        do not wish to use it because it is limited. These dialogs can also be
        used by user applications directly.
      + lazdeviceapis.pas: offers an interface to more hardware devices such
        as the accelerometer, GPS, etc. See LazDeviceAPIs
      + lazcanvas.pas: provides a TFPImageCanvas descendent implementing
        drawing in a LCL-compatible way, but 100% in Pascal.
      + lazregions.pas. LazRegions is a wholly Pascal implementation of
        regions for canvas clipping, event clipping, finding in which control
        of a region tree one an event should reach, for drawing polygons, etc.
      + customdrawncontrols.pas, customdrawndrawers.pas,
        customdrawn_common.pas, customdrawn_android.pas and
        customdrawn_winxp.pas: are the Lazarus Custom Drawn Controls -controls
        which imitate the standard LCL ones, but with the difference that they
        are non-native and support skinning.
  - New APIs added to the LCL to improve support of accessibility software
    such as screen readers.
* IDE changes:
  - Many improvments.
  - The detailed list of changes can be found here:
    http://wiki.lazarus.freepascal.org/New_IDE_features_since#v1.0_.282012-08-29.29
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_release_notes#IDE_Changes
* Debugger / Editor changes:
  - Added pascal sources and breakpoints to the disassembler
  - Added threads dialog.
* Components changes:
  - TAChart: many fixes and new features
  - CodeTool: support Delphi style generics and new syntax extensions.
  - AggPas: removed to honor free licencing. (Closes: Bug#708695)
[Bart Martens]
* New debian/watch file fixing issues with upstream RC release.
[Abou Al Montacir]
* Avoid changing files in .pc hidden directory, these are used by quilt for
  internal purpose and could lead to surprises during build.
[Paul Gevers]
* Updated get-orig-source target and it compinion script orig-tar.sh so that they
  repack the source file, allowing bug 708695 to be fixed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
{
2
 
 *****************************************************************************
3
 
 *                                                                           *
4
 
 *  This file is part of the Lazarus Component Library (LCL)                 *
5
 
 *                                                                           *
6
 
 *  See the file COPYING.modifiedLGPL.txt, included in this distribution,    *
7
 
 *  for details about the copyright.                                         *
8
 
 *                                                                           *
9
 
 *  This program is distributed in the hope that it will be useful,          *
10
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of           *
11
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     *
12
 
 *                                                                           *
13
 
 *****************************************************************************
14
 
}
15
 
unit LConvEncoding;
16
 
 
17
 
{$mode objfpc}{$H+}
18
 
 
19
 
interface
20
 
 
21
 
{$IFNDEF DisableIconv}
22
 
{$IFDEF UNIX}{$IF not defined(VER2_2_0) and not defined(VER2_2_2)}{$DEFINE HasIconvEnc}{$ENDIF}{$ENDIF}
23
 
{$ENDIF}
24
 
 
25
 
uses
26
 
  SysUtils, Classes, dos, LCLProc
27
 
  {$IFDEF HasIconvEnc},iconvenc{$ENDIF};
28
 
const
29
 
  EncodingUTF8 = 'utf8';
30
 
  EncodingAnsi = 'ansi';
31
 
  EncodingUTF8BOM = 'utf8bom'; // UTF-8 with byte order mark
32
 
  EncodingUCS2LE = 'ucs2le'; // UCS 2 byte little endian
33
 
  EncodingUCS2BE = 'ucs2be'; // UCS 2 byte big endian
34
 
 
35
 
function GuessEncoding(const s: string): string;
36
 
 
37
 
function ConvertEncoding(const s, FromEncoding, ToEncoding: string): string;
38
 
 
39
 
function GetDefaultTextEncoding: string;
40
 
function NormalizeEncoding(const Encoding: string): string;
41
 
 
42
 
type
43
 
  TConvertEncodingFunction = function(const s: string): string;
44
 
  TCharToUTF8Table = array[char] of PChar;
45
 
  TUnicodeToCharID = function(Unicode: cardinal): integer;
46
 
var
47
 
  ConvertAnsiToUTF8: TConvertEncodingFunction = nil;
48
 
  ConvertUTF8ToAnsi: TConvertEncodingFunction = nil;
49
 
  
50
 
function UTF8BOMToUTF8(const s: string): string; // UTF8 with BOM
51
 
function ISO_8859_1ToUTF8(const s: string): string; // central europe
52
 
function ISO_8859_2ToUTF8(const s: string): string; // eastern europe
53
 
function CP1250ToUTF8(const s: string): string; // central europe
54
 
function CP1251ToUTF8(const s: string): string; // cyrillic
55
 
function CP1252ToUTF8(const s: string): string; // latin 1
56
 
function CP1253ToUTF8(const s: string): string; // greek
57
 
function CP1254ToUTF8(const s: string): string; // turkish
58
 
function CP1255ToUTF8(const s: string): string; // hebrew
59
 
function CP1256ToUTF8(const s: string): string; // arabic
60
 
function CP1257ToUTF8(const s: string): string; // baltic
61
 
function CP1258ToUTF8(const s: string): string; // vietnam
62
 
function CP437ToUTF8(const s: string): string;  // DOS central europe
63
 
function CP850ToUTF8(const s: string): string;  // DOS western europe
64
 
function CP866ToUTF8(const s: string): string;  // DOS and Windows console's cyrillic
65
 
function CP874ToUTF8(const s: string): string;  // thai
66
 
function KOI8ToUTF8(const s: string): string;  // russian cyrillic
67
 
function SingleByteToUTF8(const s: string;
68
 
                          const Table: TCharToUTF8Table): string;
69
 
function UCS2LEToUTF8(const s: string): string; // UCS2-LE 2byte little endian
70
 
function UCS2BEToUTF8(const s: string): string; // UCS2-BE 2byte big endian
71
 
 
72
 
function UTF8ToUTF8BOM(const s: string): string; // UTF8 with BOM
73
 
function UTF8ToISO_8859_1(const s: string): string; // central europe
74
 
function UTF8ToISO_8859_2(const s: string): string; // eastern europe
75
 
function UTF8ToCP1250(const s: string): string; // central europe
76
 
function UTF8ToCP1251(const s: string): string; // cyrillic
77
 
function UTF8ToCP1252(const s: string): string; // latin 1
78
 
function UTF8ToCP1253(const s: string): string; // greek
79
 
function UTF8ToCP1254(const s: string): string; // turkish
80
 
function UTF8ToCP1255(const s: string): string; // hebrew
81
 
function UTF8ToCP1256(const s: string): string; // arabic
82
 
function UTF8ToCP1257(const s: string): string; // baltic
83
 
function UTF8ToCP1258(const s: string): string; // vietnam
84
 
function UTF8ToCP437(const s: string): string;  // DOS central europe
85
 
function UTF8ToCP850(const s: string): string;  // DOS western europe
86
 
function UTF8ToCP866(const s: string): string;  // DOS and Windows console's cyrillic
87
 
function UTF8ToCP874(const s: string): string;  // thai
88
 
function UTF8ToKOI8(const s: string): string;  // russian cyrillic
89
 
function UTF8ToSingleByte(const s: string;
90
 
                          const UTF8CharConvFunc: TUnicodeToCharID): string;
91
 
function UTF8ToUCS2LE(const s: string): string; // UCS2-LE 2byte little endian
92
 
function UTF8ToUCS2BE(const s: string): string; // UCS2-BE 2byte big endian
93
 
 
94
 
// Asian encodings
95
 
 
96
 
function CP936ToUTF8(const s: string): string;      // Chinese
97
 
function CP950ToUTF8(const s: string): string;      // Chinese Complex
98
 
function CP949ToUTF8(const s: string): string;      // korea
99
 
function CP932ToUTF8(const s: string): string;      // japanese
100
 
 
101
 
function SingleByteToUTF8Ex(const s: string; CodeP: integer): string;
102
 
 
103
 
function UTF8ToCP936(const s: string): string;      // Chinese, essentially the same as GB 2312 and a predecessor to GB 18030
104
 
function UTF8ToCP950(const s: string): string;      // Chinese Complex
105
 
function UTF8ToCP949(const s: string): string;      // korea
106
 
function UTF8ToCP932(const s: string): string;      // japanese
107
 
 
108
 
function UTF8ToSingleByteEx(const s: string;
109
 
                          const UTF8CharConvFunc: TUnicodeToCharID): string;
110
 
 
111
 
procedure GetSupportedEncodings(List: TStrings);
112
 
 
113
 
implementation
114
 
 
115
 
{$IFDEF Windows}
116
 
uses Windows;
117
 
{$ENDIF}
118
 
 
119
 
var EncodingValid: boolean = false;
120
 
    DefaultTextEncoding: string = EncodingAnsi;
121
 
 
122
 
{$include include/asiancodepages.inc}
123
 
{$include include/asiancodepagefunctions.inc}
124
 
 
125
 
{$IFDEF Windows}
126
 
function GetWindowsEncoding: string;
127
 
var
128
 
  cp : UINT;
129
 
{$IFDEF WinCE}
130
 
// CP_UTF8 is missing in the windows unit of the Windows CE RTL
131
 
const
132
 
  CP_UTF8 = 65001;
133
 
{$ENDIF}
134
 
begin
135
 
  cp := GetACP;
136
 
  case cp of
137
 
    CP_UTF8: Result := EncodingUTF8;
138
 
  else
139
 
    Result:='cp'+IntToStr(GetACP);
140
 
  end;
141
 
end;
142
 
{$ELSE}
143
 
{$IFNDEF Darwin}
144
 
function GetUnixEncoding:string;
145
 
var
146
 
  Lang: string;
147
 
  i: integer;
148
 
begin
149
 
  Result:=EncodingAnsi;
150
 
 
151
 
  lang := GetEnv('LC_ALL');
152
 
  if Length(lang) = 0 then
153
 
  begin
154
 
    lang := GetEnv('LC_MESSAGES');
155
 
    if Length(lang) = 0 then
156
 
    begin
157
 
      lang := GetEnv('LANG');
158
 
    end;
159
 
  end;
160
 
  i:=pos('.',Lang);
161
 
  if (i>0) and (i<=length(Lang)) then
162
 
    Result:=copy(Lang,i+1,length(Lang)-i);
163
 
end;
164
 
{$ENDIF}
165
 
{$ENDIF}
166
 
 
167
 
function GetDefaultTextEncoding: string;
168
 
begin
169
 
  if EncodingValid then begin
170
 
    Result:=DefaultTextEncoding;
171
 
    exit;
172
 
  end;
173
 
 
174
 
  {$IFDEF Windows}
175
 
  Result:=GetWindowsEncoding;
176
 
  {$ELSE}
177
 
  {$IFDEF Darwin}
178
 
  Result:=EncodingUTF8;
179
 
  {$ELSE}
180
 
  Result:=GetUnixEncoding;
181
 
  {$ENDIF}
182
 
  {$ENDIF}
183
 
 
184
 
  Result:=NormalizeEncoding(Result);
185
 
 
186
 
  DefaultTextEncoding:=Result;
187
 
  EncodingValid:=true;
188
 
end;
189
 
 
190
 
function NormalizeEncoding(const Encoding: string): string;
191
 
var
192
 
  i: Integer;
193
 
begin
194
 
  Result:=LowerCase(Encoding);
195
 
  for i:=length(Result) downto 1 do
196
 
    if Result[i]='-' then System.Delete(Result,i,1);
197
 
end;
198
 
 
199
 
const
200
 
  ArrayISO_8859_1ToUTF8: TCharToUTF8Table = (
201
 
    #0,                 // #0
202
 
    #1,                 // #1
203
 
    #2,                 // #2
204
 
    #3,                 // #3
205
 
    #4,                 // #4
206
 
    #5,                 // #5
207
 
    #6,                 // #6
208
 
    #7,                 // #7
209
 
    #8,                 // #8
210
 
    #9,                 // #9
211
 
    #10,                // #10
212
 
    #11,                // #11
213
 
    #12,                // #12
214
 
    #13,                // #13
215
 
    #14,                // #14
216
 
    #15,                // #15
217
 
    #16,                // #16
218
 
    #17,                // #17
219
 
    #18,                // #18
220
 
    #19,                // #19
221
 
    #20,                // #20
222
 
    #21,                // #21
223
 
    #22,                // #22
224
 
    #23,                // #23
225
 
    #24,                // #24
226
 
    #25,                // #25
227
 
    #26,                // #26
228
 
    #27,                // #27
229
 
    #28,                // #28
230
 
    #29,                // #29
231
 
    #30,                // #30
232
 
    #31,                // #31
233
 
    ' ',                // ' '
234
 
    '!',                // '!'
235
 
    '"',                // '"'
236
 
    '#',                // '#'
237
 
    '$',                // '$'
238
 
    '%',                // '%'
239
 
    '&',                // '&'
240
 
    '''',               // ''''
241
 
    '(',                // '('
242
 
    ')',                // ')'
243
 
    '*',                // '*'
244
 
    '+',                // '+'
245
 
    ',',                // ','
246
 
    '-',                // '-'
247
 
    '.',                // '.'
248
 
    '/',                // '/'
249
 
    '0',                // '0'
250
 
    '1',                // '1'
251
 
    '2',                // '2'
252
 
    '3',                // '3'
253
 
    '4',                // '4'
254
 
    '5',                // '5'
255
 
    '6',                // '6'
256
 
    '7',                // '7'
257
 
    '8',                // '8'
258
 
    '9',                // '9'
259
 
    ':',                // ':'
260
 
    ';',                // ';'
261
 
    '<',                // '<'
262
 
    '=',                // '='
263
 
    '>',                // '>'
264
 
    '?',                // '?'
265
 
    '@',                // '@'
266
 
    'A',                // 'A'
267
 
    'B',                // 'B'
268
 
    'C',                // 'C'
269
 
    'D',                // 'D'
270
 
    'E',                // 'E'
271
 
    'F',                // 'F'
272
 
    'G',                // 'G'
273
 
    'H',                // 'H'
274
 
    'I',                // 'I'
275
 
    'J',                // 'J'
276
 
    'K',                // 'K'
277
 
    'L',                // 'L'
278
 
    'M',                // 'M'
279
 
    'N',                // 'N'
280
 
    'O',                // 'O'
281
 
    'P',                // 'P'
282
 
    'Q',                // 'Q'
283
 
    'R',                // 'R'
284
 
    'S',                // 'S'
285
 
    'T',                // 'T'
286
 
    'U',                // 'U'
287
 
    'V',                // 'V'
288
 
    'W',                // 'W'
289
 
    'X',                // 'X'
290
 
    'Y',                // 'Y'
291
 
    'Z',                // 'Z'
292
 
    '[',                // '['
293
 
    '\',                // '\'
294
 
    ']',                // ']'
295
 
    '^',                // '^'
296
 
    '_',                // '_'
297
 
    '`',                // '`'
298
 
    'a',                // 'a'
299
 
    'b',                // 'b'
300
 
    'c',                // 'c'
301
 
    'd',                // 'd'
302
 
    'e',                // 'e'
303
 
    'f',                // 'f'
304
 
    'g',                // 'g'
305
 
    'h',                // 'h'
306
 
    'i',                // 'i'
307
 
    'j',                // 'j'
308
 
    'k',                // 'k'
309
 
    'l',                // 'l'
310
 
    'm',                // 'm'
311
 
    'n',                // 'n'
312
 
    'o',                // 'o'
313
 
    'p',                // 'p'
314
 
    'q',                // 'q'
315
 
    'r',                // 'r'
316
 
    's',                // 's'
317
 
    't',                // 't'
318
 
    'u',                // 'u'
319
 
    'v',                // 'v'
320
 
    'w',                // 'w'
321
 
    'x',                // 'x'
322
 
    'y',                // 'y'
323
 
    'z',                // 'z'
324
 
    '{',                // '{'
325
 
    '|',                // '|'
326
 
    '}',                // '}'
327
 
    '~',                // '~'
328
 
    #127,               // #127
329
 
    #194#128,           // #128
330
 
    #194#129,           // #129
331
 
    #194#130,           // #130
332
 
    #194#131,           // #131
333
 
    #194#132,           // #132
334
 
    #194#133,           // #133
335
 
    #194#134,           // #134
336
 
    #194#135,           // #135
337
 
    #194#136,           // #136
338
 
    #194#137,           // #137
339
 
    #194#138,           // #138
340
 
    #194#139,           // #139
341
 
    #194#140,           // #140
342
 
    #194#141,           // #141
343
 
    #194#142,           // #142
344
 
    #194#143,           // #143
345
 
    #194#144,           // #144
346
 
    #194#145,           // #145
347
 
    #194#146,           // #146
348
 
    #194#147,           // #147
349
 
    #194#148,           // #148
350
 
    #194#149,           // #149
351
 
    #194#150,           // #150
352
 
    #194#151,           // #151
353
 
    #194#152,           // #152
354
 
    #194#153,           // #153
355
 
    #194#154,           // #154
356
 
    #194#155,           // #155
357
 
    #194#156,           // #156
358
 
    #194#157,           // #157
359
 
    #194#158,           // #158
360
 
    #194#159,           // #159
361
 
    #194#160,           // #160
362
 
    #194#161,           // #161
363
 
    #194#162,           // #162
364
 
    #194#163,           // #163
365
 
    #194#164,           // #164
366
 
    #194#165,           // #165
367
 
    #194#166,           // #166
368
 
    #194#167,           // #167
369
 
    #194#168,           // #168
370
 
    #194#169,           // #169
371
 
    #194#170,           // #170
372
 
    #194#171,           // #171
373
 
    #194#172,           // #172
374
 
    #194#173,           // #173
375
 
    #194#174,           // #174
376
 
    #194#175,           // #175
377
 
    #194#176,           // #176
378
 
    #194#177,           // #177
379
 
    #194#178,           // #178
380
 
    #194#179,           // #179
381
 
    #194#180,           // #180
382
 
    #194#181,           // #181
383
 
    #194#182,           // #182
384
 
    #194#183,           // #183
385
 
    #194#184,           // #184
386
 
    #194#185,           // #185
387
 
    #194#186,           // #186
388
 
    #194#187,           // #187
389
 
    #194#188,           // #188
390
 
    #194#189,           // #189
391
 
    #194#190,           // #190
392
 
    #194#191,           // #191
393
 
    #195#128,           // #192
394
 
    #195#129,           // #193
395
 
    #195#130,           // #194
396
 
    #195#131,           // #195
397
 
    #195#132,           // #196
398
 
    #195#133,           // #197
399
 
    #195#134,           // #198
400
 
    #195#135,           // #199
401
 
    #195#136,           // #200
402
 
    #195#137,           // #201
403
 
    #195#138,           // #202
404
 
    #195#139,           // #203
405
 
    #195#140,           // #204
406
 
    #195#141,           // #205
407
 
    #195#142,           // #206
408
 
    #195#143,           // #207
409
 
    #195#144,           // #208
410
 
    #195#145,           // #209
411
 
    #195#146,           // #210
412
 
    #195#147,           // #211
413
 
    #195#148,           // #212
414
 
    #195#149,           // #213
415
 
    #195#150,           // #214
416
 
    #195#151,           // #215
417
 
    #195#152,           // #216
418
 
    #195#153,           // #217
419
 
    #195#154,           // #218
420
 
    #195#155,           // #219
421
 
    #195#156,           // #220
422
 
    #195#157,           // #221
423
 
    #195#158,           // #222
424
 
    #195#159,           // #223
425
 
    #195#160,           // #224
426
 
    #195#161,           // #225
427
 
    #195#162,           // #226
428
 
    #195#163,           // #227
429
 
    #195#164,           // #228
430
 
    #195#165,           // #229
431
 
    #195#166,           // #230
432
 
    #195#167,           // #231
433
 
    #195#168,           // #232
434
 
    #195#169,           // #233
435
 
    #195#170,           // #234
436
 
    #195#171,           // #235
437
 
    #195#172,           // #236
438
 
    #195#173,           // #237
439
 
    #195#174,           // #238
440
 
    #195#175,           // #239
441
 
    #195#176,           // #240
442
 
    #195#177,           // #241
443
 
    #195#178,           // #242
444
 
    #195#179,           // #243
445
 
    #195#180,           // #244
446
 
    #195#181,           // #245
447
 
    #195#182,           // #246
448
 
    #195#183,           // #247
449
 
    #195#184,           // #248
450
 
    #195#185,           // #249
451
 
    #195#186,           // #250
452
 
    #195#187,           // #251
453
 
    #195#188,           // #252
454
 
    #195#189,           // #253
455
 
    #195#190,           // #254
456
 
    #195#191            // #255
457
 
  );
458
 
 
459
 
  ArrayISO_8859_2ToUTF8: TCharToUTF8Table = (
460
 
    #0,                 // #0
461
 
    #1,                 // #1
462
 
    #2,                 // #2
463
 
    #3,                 // #3
464
 
    #4,                 // #4
465
 
    #5,                 // #5
466
 
    #6,                 // #6
467
 
    #7,                 // #7
468
 
    #8,                 // #8
469
 
    #9,                 // #9
470
 
    #10,                // #10
471
 
    #11,                // #11
472
 
    #12,                // #12
473
 
    #13,                // #13
474
 
    #14,                // #14
475
 
    #15,                // #15
476
 
    #16,                // #16
477
 
    #17,                // #17
478
 
    #18,                // #18
479
 
    #19,                // #19
480
 
    #20,                // #20
481
 
    #21,                // #21
482
 
    #22,                // #22
483
 
    #23,                // #23
484
 
    #24,                // #24
485
 
    #25,                // #25
486
 
    #26,                // #26
487
 
    #27,                // #27
488
 
    #28,                // #28
489
 
    #29,                // #29
490
 
    #30,                // #30
491
 
    #31,                // #31
492
 
    ' ',                // ' '
493
 
    '!',                // '!'
494
 
    '"',                // '"'
495
 
    '#',                // '#'
496
 
    '$',                // '$'
497
 
    '%',                // '%'
498
 
    '&',                // '&'
499
 
    '''',               // ''''
500
 
    '(',                // '('
501
 
    ')',                // ')'
502
 
    '*',                // '*'
503
 
    '+',                // '+'
504
 
    ',',                // ','
505
 
    '-',                // '-'
506
 
    '.',                // '.'
507
 
    '/',                // '/'
508
 
    '0',                // '0'
509
 
    '1',                // '1'
510
 
    '2',                // '2'
511
 
    '3',                // '3'
512
 
    '4',                // '4'
513
 
    '5',                // '5'
514
 
    '6',                // '6'
515
 
    '7',                // '7'
516
 
    '8',                // '8'
517
 
    '9',                // '9'
518
 
    ':',                // ':'
519
 
    ';',                // ';'
520
 
    '<',                // '<'
521
 
    '=',                // '='
522
 
    '>',                // '>'
523
 
    '?',                // '?'
524
 
    '@',                // '@'
525
 
    'A',                // 'A'
526
 
    'B',                // 'B'
527
 
    'C',                // 'C'
528
 
    'D',                // 'D'
529
 
    'E',                // 'E'
530
 
    'F',                // 'F'
531
 
    'G',                // 'G'
532
 
    'H',                // 'H'
533
 
    'I',                // 'I'
534
 
    'J',                // 'J'
535
 
    'K',                // 'K'
536
 
    'L',                // 'L'
537
 
    'M',                // 'M'
538
 
    'N',                // 'N'
539
 
    'O',                // 'O'
540
 
    'P',                // 'P'
541
 
    'Q',                // 'Q'
542
 
    'R',                // 'R'
543
 
    'S',                // 'S'
544
 
    'T',                // 'T'
545
 
    'U',                // 'U'
546
 
    'V',                // 'V'
547
 
    'W',                // 'W'
548
 
    'X',                // 'X'
549
 
    'Y',                // 'Y'
550
 
    'Z',                // 'Z'
551
 
    '[',                // '['
552
 
    '\',                // '\'
553
 
    ']',                // ']'
554
 
    '^',                // '^'
555
 
    '_',                // '_'
556
 
    '`',                // '`'
557
 
    'a',                // 'a'
558
 
    'b',                // 'b'
559
 
    'c',                // 'c'
560
 
    'd',                // 'd'
561
 
    'e',                // 'e'
562
 
    'f',                // 'f'
563
 
    'g',                // 'g'
564
 
    'h',                // 'h'
565
 
    'i',                // 'i'
566
 
    'j',                // 'j'
567
 
    'k',                // 'k'
568
 
    'l',                // 'l'
569
 
    'm',                // 'm'
570
 
    'n',                // 'n'
571
 
    'o',                // 'o'
572
 
    'p',                // 'p'
573
 
    'q',                // 'q'
574
 
    'r',                // 'r'
575
 
    's',                // 's'
576
 
    't',                // 't'
577
 
    'u',                // 'u'
578
 
    'v',                // 'v'
579
 
    'w',                // 'w'
580
 
    'x',                // 'x'
581
 
    'y',                // 'y'
582
 
    'z',                // 'z'
583
 
    '{',                // '{'
584
 
    '|',                // '|'
585
 
    '}',                // '}'
586
 
    '~',                // '~'
587
 
    #127,               // #127
588
 
    #194#128,           // #128
589
 
    #194#129,           // #129
590
 
    #194#130,           // #130
591
 
    #194#131,           // #131
592
 
    #194#132,           // #132
593
 
    #194#133,           // #133
594
 
    #194#134,           // #134
595
 
    #194#135,           // #135
596
 
    #194#136,           // #136
597
 
    #194#137,           // #137
598
 
    #194#138,           // #138
599
 
    #194#139,           // #139
600
 
    #194#140,           // #140
601
 
    #194#141,           // #141
602
 
    #194#142,           // #142
603
 
    #194#143,           // #143
604
 
    #194#144,           // #144
605
 
    #194#145,           // #145
606
 
    #194#146,           // #146
607
 
    #194#147,           // #147
608
 
    #194#148,           // #148
609
 
    #194#149,           // #149
610
 
    #194#150,           // #150
611
 
    #194#151,           // #151
612
 
    #194#152,           // #152
613
 
    #194#153,           // #153
614
 
    #194#154,           // #154
615
 
    #194#155,           // #155
616
 
    #194#156,           // #156
617
 
    #194#157,           // #157
618
 
    #194#158,           // #158
619
 
    #194#159,           // #159
620
 
    #194#160,           // #160
621
 
    #196#132,           // #161
622
 
    #203#152,           // #162
623
 
    #197#129,           // #163
624
 
    #194#164,           // #164
625
 
    #196#189,           // #165
626
 
    #197#154,           // #166
627
 
    #194#167,           // #167
628
 
    #194#168,           // #168
629
 
    #197#160,           // #169
630
 
    #197#158,           // #170
631
 
    #197#164,           // #171
632
 
    #197#185,           // #172
633
 
    #194#173,           // #173
634
 
    #197#189,           // #174
635
 
    #197#187,           // #175
636
 
    #194#176,           // #176
637
 
    #196#133,           // #177
638
 
    #203#155,           // #178
639
 
    #197#130,           // #179
640
 
    #194#180,           // #180
641
 
    #196#190,           // #181
642
 
    #197#155,           // #182
643
 
    #203#135,           // #183
644
 
    #194#184,           // #184
645
 
    #197#161,           // #185
646
 
    #197#159,           // #186
647
 
    #197#165,           // #187
648
 
    #197#186,           // #188
649
 
    #203#157,           // #189
650
 
    #197#190,           // #190
651
 
    #197#188,           // #191
652
 
    #197#148,           // #192
653
 
    #195#129,           // #193
654
 
    #195#130,           // #194
655
 
    #196#130,           // #195
656
 
    #195#132,           // #196
657
 
    #196#185,           // #197
658
 
    #196#134,           // #198
659
 
    #195#135,           // #199
660
 
    #196#140,           // #200
661
 
    #195#137,           // #201
662
 
    #196#152,           // #202
663
 
    #195#139,           // #203
664
 
    #196#154,           // #204
665
 
    #195#141,           // #205
666
 
    #195#142,           // #206
667
 
    #196#142,           // #207
668
 
    #196#144,           // #208
669
 
    #197#131,           // #209
670
 
    #197#135,           // #210
671
 
    #195#147,           // #211
672
 
    #195#148,           // #212
673
 
    #197#144,           // #213
674
 
    #195#150,           // #214
675
 
    #195#151,           // #215
676
 
    #197#152,           // #216
677
 
    #197#174,           // #217
678
 
    #195#154,           // #218
679
 
    #197#176,           // #219
680
 
    #195#156,           // #220
681
 
    #195#157,           // #221
682
 
    #197#162,           // #222
683
 
    #195#159,           // #223
684
 
    #197#149,           // #224
685
 
    #195#161,           // #225
686
 
    #195#162,           // #226
687
 
    #196#131,           // #227
688
 
    #195#164,           // #228
689
 
    #196#186,           // #229
690
 
    #196#135,           // #230
691
 
    #195#167,           // #231
692
 
    #196#141,           // #232
693
 
    #195#169,           // #233
694
 
    #196#153,           // #234
695
 
    #195#171,           // #235
696
 
    #196#155,           // #236
697
 
    #195#173,           // #237
698
 
    #195#174,           // #238
699
 
    #196#143,           // #239
700
 
    #196#145,           // #240
701
 
    #197#132,           // #241
702
 
    #197#136,           // #242
703
 
    #195#179,           // #243
704
 
    #195#180,           // #244
705
 
    #197#145,           // #245
706
 
    #195#182,           // #246
707
 
    #195#183,           // #247
708
 
    #197#153,           // #248
709
 
    #197#175,           // #249
710
 
    #195#186,           // #250
711
 
    #197#177,           // #251
712
 
    #195#188,           // #252
713
 
    #195#189,           // #253
714
 
    #197#163,           // #254
715
 
    #203#153            // #255
716
 
  );
717
 
 
718
 
 
719
 
  ArrayCP1250ToUTF8: TCharToUTF8Table = (
720
 
    #0,                 // #0
721
 
    #1,                 // #1
722
 
    #2,                 // #2
723
 
    #3,                 // #3
724
 
    #4,                 // #4
725
 
    #5,                 // #5
726
 
    #6,                 // #6
727
 
    #7,                 // #7
728
 
    #8,                 // #8
729
 
    #9,                 // #9
730
 
    #10,                // #10
731
 
    #11,                // #11
732
 
    #12,                // #12
733
 
    #13,                // #13
734
 
    #14,                // #14
735
 
    #15,                // #15
736
 
    #16,                // #16
737
 
    #17,                // #17
738
 
    #18,                // #18
739
 
    #19,                // #19
740
 
    #20,                // #20
741
 
    #21,                // #21
742
 
    #22,                // #22
743
 
    #23,                // #23
744
 
    #24,                // #24
745
 
    #25,                // #25
746
 
    #26,                // #26
747
 
    #27,                // #27
748
 
    #28,                // #28
749
 
    #29,                // #29
750
 
    #30,                // #30
751
 
    #31,                // #31
752
 
    ' ',                // ' '
753
 
    '!',                // '!'
754
 
    '"',                // '"'
755
 
    '#',                // '#'
756
 
    '$',                // '$'
757
 
    '%',                // '%'
758
 
    '&',                // '&'
759
 
    '''',               // ''''
760
 
    '(',                // '('
761
 
    ')',                // ')'
762
 
    '*',                // '*'
763
 
    '+',                // '+'
764
 
    ',',                // ','
765
 
    '-',                // '-'
766
 
    '.',                // '.'
767
 
    '/',                // '/'
768
 
    '0',                // '0'
769
 
    '1',                // '1'
770
 
    '2',                // '2'
771
 
    '3',                // '3'
772
 
    '4',                // '4'
773
 
    '5',                // '5'
774
 
    '6',                // '6'
775
 
    '7',                // '7'
776
 
    '8',                // '8'
777
 
    '9',                // '9'
778
 
    ':',                // ':'
779
 
    ';',                // ';'
780
 
    '<',                // '<'
781
 
    '=',                // '='
782
 
    '>',                // '>'
783
 
    '?',                // '?'
784
 
    '@',                // '@'
785
 
    'A',                // 'A'
786
 
    'B',                // 'B'
787
 
    'C',                // 'C'
788
 
    'D',                // 'D'
789
 
    'E',                // 'E'
790
 
    'F',                // 'F'
791
 
    'G',                // 'G'
792
 
    'H',                // 'H'
793
 
    'I',                // 'I'
794
 
    'J',                // 'J'
795
 
    'K',                // 'K'
796
 
    'L',                // 'L'
797
 
    'M',                // 'M'
798
 
    'N',                // 'N'
799
 
    'O',                // 'O'
800
 
    'P',                // 'P'
801
 
    'Q',                // 'Q'
802
 
    'R',                // 'R'
803
 
    'S',                // 'S'
804
 
    'T',                // 'T'
805
 
    'U',                // 'U'
806
 
    'V',                // 'V'
807
 
    'W',                // 'W'
808
 
    'X',                // 'X'
809
 
    'Y',                // 'Y'
810
 
    'Z',                // 'Z'
811
 
    '[',                // '['
812
 
    '\',                // '\'
813
 
    ']',                // ']'
814
 
    '^',                // '^'
815
 
    '_',                // '_'
816
 
    '`',                // '`'
817
 
    'a',                // 'a'
818
 
    'b',                // 'b'
819
 
    'c',                // 'c'
820
 
    'd',                // 'd'
821
 
    'e',                // 'e'
822
 
    'f',                // 'f'
823
 
    'g',                // 'g'
824
 
    'h',                // 'h'
825
 
    'i',                // 'i'
826
 
    'j',                // 'j'
827
 
    'k',                // 'k'
828
 
    'l',                // 'l'
829
 
    'm',                // 'm'
830
 
    'n',                // 'n'
831
 
    'o',                // 'o'
832
 
    'p',                // 'p'
833
 
    'q',                // 'q'
834
 
    'r',                // 'r'
835
 
    's',                // 's'
836
 
    't',                // 't'
837
 
    'u',                // 'u'
838
 
    'v',                // 'v'
839
 
    'w',                // 'w'
840
 
    'x',                // 'x'
841
 
    'y',                // 'y'
842
 
    'z',                // 'z'
843
 
    '{',                // '{'
844
 
    '|',                // '|'
845
 
    '}',                // '}'
846
 
    '~',                // '~'
847
 
    #127,               // #127
848
 
    #226#130#172,       // #128
849
 
    '',                 // #129
850
 
    #226#128#154,       // #130
851
 
    '',                 // #131
852
 
    #226#128#158,       // #132
853
 
    #226#128#166,       // #133
854
 
    #226#128#160,       // #134
855
 
    #226#128#161,       // #135
856
 
    '',                 // #136
857
 
    #226#128#176,       // #137
858
 
    #197#160,           // #138
859
 
    #226#128#185,       // #139
860
 
    #197#154,           // #140
861
 
    #197#164,           // #141
862
 
    #197#189,           // #142
863
 
    #197#185,           // #143
864
 
    '',                 // #144
865
 
    #226#128#152,       // #145
866
 
    #226#128#153,       // #146
867
 
    #226#128#156,       // #147
868
 
    #226#128#157,       // #148
869
 
    #226#128#162,       // #149
870
 
    #226#128#147,       // #150
871
 
    #226#128#148,       // #151
872
 
    '',                 // #152
873
 
    #226#132#162,       // #153
874
 
    #197#161,           // #154
875
 
    #226#128#186,       // #155
876
 
    #197#155,           // #156
877
 
    #197#165,           // #157
878
 
    #197#190,           // #158
879
 
    #197#186,           // #159
880
 
    #194#160,           // #160
881
 
    #203#135,           // #161
882
 
    #203#152,           // #162
883
 
    #197#129,           // #163
884
 
    #194#164,           // #164
885
 
    #196#132,           // #165
886
 
    #194#166,           // #166
887
 
    #194#167,           // #167
888
 
    #194#168,           // #168
889
 
    #194#169,           // #169
890
 
    #197#158,           // #170
891
 
    #194#171,           // #171
892
 
    #194#172,           // #172
893
 
    #194#173,           // #173
894
 
    #194#174,           // #174
895
 
    #197#187,           // #175
896
 
    #194#176,           // #176
897
 
    #194#177,           // #177
898
 
    #203#155,           // #178
899
 
    #197#130,           // #179
900
 
    #194#180,           // #180
901
 
    #194#181,           // #181
902
 
    #194#182,           // #182
903
 
    #194#183,           // #183
904
 
    #194#184,           // #184
905
 
    #196#133,           // #185
906
 
    #197#159,           // #186
907
 
    #194#187,           // #187
908
 
    #196#189,           // #188
909
 
    #203#157,           // #189
910
 
    #196#190,           // #190
911
 
    #197#188,           // #191
912
 
    #197#148,           // #192
913
 
    #195#129,           // #193
914
 
    #195#130,           // #194
915
 
    #196#130,           // #195
916
 
    #195#132,           // #196
917
 
    #196#185,           // #197
918
 
    #196#134,           // #198
919
 
    #195#135,           // #199
920
 
    #196#140,           // #200
921
 
    #195#137,           // #201
922
 
    #196#152,           // #202
923
 
    #195#139,           // #203
924
 
    #196#154,           // #204
925
 
    #195#141,           // #205
926
 
    #195#142,           // #206
927
 
    #196#142,           // #207
928
 
    #196#144,           // #208
929
 
    #197#131,           // #209
930
 
    #197#135,           // #210
931
 
    #195#147,           // #211
932
 
    #195#148,           // #212
933
 
    #197#144,           // #213
934
 
    #195#150,           // #214
935
 
    #195#151,           // #215
936
 
    #197#152,           // #216
937
 
    #197#174,           // #217
938
 
    #195#154,           // #218
939
 
    #197#176,           // #219
940
 
    #195#156,           // #220
941
 
    #195#157,           // #221
942
 
    #197#162,           // #222
943
 
    #195#159,           // #223
944
 
    #197#149,           // #224
945
 
    #195#161,           // #225
946
 
    #195#162,           // #226
947
 
    #196#131,           // #227
948
 
    #195#164,           // #228
949
 
    #196#186,           // #229
950
 
    #196#135,           // #230
951
 
    #195#167,           // #231
952
 
    #196#141,           // #232
953
 
    #195#169,           // #233
954
 
    #196#153,           // #234
955
 
    #195#171,           // #235
956
 
    #196#155,           // #236
957
 
    #195#173,           // #237
958
 
    #195#174,           // #238
959
 
    #196#143,           // #239
960
 
    #196#145,           // #240
961
 
    #197#132,           // #241
962
 
    #197#136,           // #242
963
 
    #195#179,           // #243
964
 
    #195#180,           // #244
965
 
    #197#145,           // #245
966
 
    #195#182,           // #246
967
 
    #195#183,           // #247
968
 
    #197#153,           // #248
969
 
    #197#175,           // #249
970
 
    #195#186,           // #250
971
 
    #197#177,           // #251
972
 
    #195#188,           // #252
973
 
    #195#189,           // #253
974
 
    #197#163,           // #254
975
 
    #203#153            // #255
976
 
  );
977
 
 
978
 
  ArrayCP1251ToUTF8: TCharToUTF8Table = (
979
 
    #0,                 // #0
980
 
    #1,                 // #1
981
 
    #2,                 // #2
982
 
    #3,                 // #3
983
 
    #4,                 // #4
984
 
    #5,                 // #5
985
 
    #6,                 // #6
986
 
    #7,                 // #7
987
 
    #8,                 // #8
988
 
    #9,                 // #9
989
 
    #10,                // #10
990
 
    #11,                // #11
991
 
    #12,                // #12
992
 
    #13,                // #13
993
 
    #14,                // #14
994
 
    #15,                // #15
995
 
    #16,                // #16
996
 
    #17,                // #17
997
 
    #18,                // #18
998
 
    #19,                // #19
999
 
    #20,                // #20
1000
 
    #21,                // #21
1001
 
    #22,                // #22
1002
 
    #23,                // #23
1003
 
    #24,                // #24
1004
 
    #25,                // #25
1005
 
    #26,                // #26
1006
 
    #27,                // #27
1007
 
    #28,                // #28
1008
 
    #29,                // #29
1009
 
    #30,                // #30
1010
 
    #31,                // #31
1011
 
    ' ',                // ' '
1012
 
    '!',                // '!'
1013
 
    '"',                // '"'
1014
 
    '#',                // '#'
1015
 
    '$',                // '$'
1016
 
    '%',                // '%'
1017
 
    '&',                // '&'
1018
 
    '''',               // ''''
1019
 
    '(',                // '('
1020
 
    ')',                // ')'
1021
 
    '*',                // '*'
1022
 
    '+',                // '+'
1023
 
    ',',                // ','
1024
 
    '-',                // '-'
1025
 
    '.',                // '.'
1026
 
    '/',                // '/'
1027
 
    '0',                // '0'
1028
 
    '1',                // '1'
1029
 
    '2',                // '2'
1030
 
    '3',                // '3'
1031
 
    '4',                // '4'
1032
 
    '5',                // '5'
1033
 
    '6',                // '6'
1034
 
    '7',                // '7'
1035
 
    '8',                // '8'
1036
 
    '9',                // '9'
1037
 
    ':',                // ':'
1038
 
    ';',                // ';'
1039
 
    '<',                // '<'
1040
 
    '=',                // '='
1041
 
    '>',                // '>'
1042
 
    '?',                // '?'
1043
 
    '@',                // '@'
1044
 
    'A',                // 'A'
1045
 
    'B',                // 'B'
1046
 
    'C',                // 'C'
1047
 
    'D',                // 'D'
1048
 
    'E',                // 'E'
1049
 
    'F',                // 'F'
1050
 
    'G',                // 'G'
1051
 
    'H',                // 'H'
1052
 
    'I',                // 'I'
1053
 
    'J',                // 'J'
1054
 
    'K',                // 'K'
1055
 
    'L',                // 'L'
1056
 
    'M',                // 'M'
1057
 
    'N',                // 'N'
1058
 
    'O',                // 'O'
1059
 
    'P',                // 'P'
1060
 
    'Q',                // 'Q'
1061
 
    'R',                // 'R'
1062
 
    'S',                // 'S'
1063
 
    'T',                // 'T'
1064
 
    'U',                // 'U'
1065
 
    'V',                // 'V'
1066
 
    'W',                // 'W'
1067
 
    'X',                // 'X'
1068
 
    'Y',                // 'Y'
1069
 
    'Z',                // 'Z'
1070
 
    '[',                // '['
1071
 
    '\',                // '\'
1072
 
    ']',                // ']'
1073
 
    '^',                // '^'
1074
 
    '_',                // '_'
1075
 
    '`',                // '`'
1076
 
    'a',                // 'a'
1077
 
    'b',                // 'b'
1078
 
    'c',                // 'c'
1079
 
    'd',                // 'd'
1080
 
    'e',                // 'e'
1081
 
    'f',                // 'f'
1082
 
    'g',                // 'g'
1083
 
    'h',                // 'h'
1084
 
    'i',                // 'i'
1085
 
    'j',                // 'j'
1086
 
    'k',                // 'k'
1087
 
    'l',                // 'l'
1088
 
    'm',                // 'm'
1089
 
    'n',                // 'n'
1090
 
    'o',                // 'o'
1091
 
    'p',                // 'p'
1092
 
    'q',                // 'q'
1093
 
    'r',                // 'r'
1094
 
    's',                // 's'
1095
 
    't',                // 't'
1096
 
    'u',                // 'u'
1097
 
    'v',                // 'v'
1098
 
    'w',                // 'w'
1099
 
    'x',                // 'x'
1100
 
    'y',                // 'y'
1101
 
    'z',                // 'z'
1102
 
    '{',                // '{'
1103
 
    '|',                // '|'
1104
 
    '}',                // '}'
1105
 
    '~',                // '~'
1106
 
    #127,               // #127
1107
 
    #208#130,           // #128
1108
 
    #208#131,           // #129
1109
 
    #226#128#154,       // #130
1110
 
    #209#147,           // #131
1111
 
    #226#128#158,       // #132
1112
 
    #226#128#166,       // #133
1113
 
    #226#128#160,       // #134
1114
 
    #226#128#161,       // #135
1115
 
    #226#130#172,       // #136
1116
 
    #226#128#176,       // #137
1117
 
    #208#137,           // #138
1118
 
    #226#128#185,       // #139
1119
 
    #208#138,           // #140
1120
 
    #208#140,           // #141
1121
 
    #208#139,           // #142
1122
 
    #208#143,           // #143
1123
 
    #209#146,           // #144
1124
 
    #226#128#152,       // #145
1125
 
    #226#128#153,       // #146
1126
 
    #226#128#156,       // #147
1127
 
    #226#128#157,       // #148
1128
 
    #226#128#162,       // #149
1129
 
    #226#128#147,       // #150
1130
 
    #226#128#148,       // #151
1131
 
    '',                 // #152
1132
 
    #226#132#162,       // #153
1133
 
    #209#153,           // #154
1134
 
    #226#128#186,       // #155
1135
 
    #209#154,           // #156
1136
 
    #209#156,           // #157
1137
 
    #209#155,           // #158
1138
 
    #209#159,           // #159
1139
 
    #194#160,           // #160
1140
 
    #208#142,           // #161
1141
 
    #209#158,           // #162
1142
 
    #208#136,           // #163
1143
 
    #194#164,           // #164
1144
 
    #210#144,           // #165
1145
 
    #194#166,           // #166
1146
 
    #194#167,           // #167
1147
 
    #208#129,           // #168
1148
 
    #194#169,           // #169
1149
 
    #208#132,           // #170
1150
 
    #194#171,           // #171
1151
 
    #194#172,           // #172
1152
 
    #194#173,           // #173
1153
 
    #194#174,           // #174
1154
 
    #208#135,           // #175
1155
 
    #194#176,           // #176
1156
 
    #194#177,           // #177
1157
 
    #208#134,           // #178
1158
 
    #209#150,           // #179
1159
 
    #210#145,           // #180
1160
 
    #194#181,           // #181
1161
 
    #194#182,           // #182
1162
 
    #194#183,           // #183
1163
 
    #209#145,           // #184
1164
 
    #226#132#150,       // #185
1165
 
    #209#148,           // #186
1166
 
    #194#187,           // #187
1167
 
    #209#152,           // #188
1168
 
    #208#133,           // #189
1169
 
    #209#149,           // #190
1170
 
    #209#151,           // #191
1171
 
    #208#144,           // #192
1172
 
    #208#145,           // #193
1173
 
    #208#146,           // #194
1174
 
    #208#147,           // #195
1175
 
    #208#148,           // #196
1176
 
    #208#149,           // #197
1177
 
    #208#150,           // #198
1178
 
    #208#151,           // #199
1179
 
    #208#152,           // #200
1180
 
    #208#153,           // #201
1181
 
    #208#154,           // #202
1182
 
    #208#155,           // #203
1183
 
    #208#156,           // #204
1184
 
    #208#157,           // #205
1185
 
    #208#158,           // #206
1186
 
    #208#159,           // #207
1187
 
    #208#160,           // #208
1188
 
    #208#161,           // #209
1189
 
    #208#162,           // #210
1190
 
    #208#163,           // #211
1191
 
    #208#164,           // #212
1192
 
    #208#165,           // #213
1193
 
    #208#166,           // #214
1194
 
    #208#167,           // #215
1195
 
    #208#168,           // #216
1196
 
    #208#169,           // #217
1197
 
    #208#170,           // #218
1198
 
    #208#171,           // #219
1199
 
    #208#172,           // #220
1200
 
    #208#173,           // #221
1201
 
    #208#174,           // #222
1202
 
    #208#175,           // #223
1203
 
    #208#176,           // #224
1204
 
    #208#177,           // #225
1205
 
    #208#178,           // #226
1206
 
    #208#179,           // #227
1207
 
    #208#180,           // #228
1208
 
    #208#181,           // #229
1209
 
    #208#182,           // #230
1210
 
    #208#183,           // #231
1211
 
    #208#184,           // #232
1212
 
    #208#185,           // #233
1213
 
    #208#186,           // #234
1214
 
    #208#187,           // #235
1215
 
    #208#188,           // #236
1216
 
    #208#189,           // #237
1217
 
    #208#190,           // #238
1218
 
    #208#191,           // #239
1219
 
    #209#128,           // #240
1220
 
    #209#129,           // #241
1221
 
    #209#130,           // #242
1222
 
    #209#131,           // #243
1223
 
    #209#132,           // #244
1224
 
    #209#133,           // #245
1225
 
    #209#134,           // #246
1226
 
    #209#135,           // #247
1227
 
    #209#136,           // #248
1228
 
    #209#137,           // #249
1229
 
    #209#138,           // #250
1230
 
    #209#139,           // #251
1231
 
    #209#140,           // #252
1232
 
    #209#141,           // #253
1233
 
    #209#142,           // #254
1234
 
    #209#143            // #255
1235
 
  );
1236
 
 
1237
 
  ArrayCP1252ToUTF8: TCharToUTF8Table = (
1238
 
    #0,                 // #0
1239
 
    #1,                 // #1
1240
 
    #2,                 // #2
1241
 
    #3,                 // #3
1242
 
    #4,                 // #4
1243
 
    #5,                 // #5
1244
 
    #6,                 // #6
1245
 
    #7,                 // #7
1246
 
    #8,                 // #8
1247
 
    #9,                 // #9
1248
 
    #10,                // #10
1249
 
    #11,                // #11
1250
 
    #12,                // #12
1251
 
    #13,                // #13
1252
 
    #14,                // #14
1253
 
    #15,                // #15
1254
 
    #16,                // #16
1255
 
    #17,                // #17
1256
 
    #18,                // #18
1257
 
    #19,                // #19
1258
 
    #20,                // #20
1259
 
    #21,                // #21
1260
 
    #22,                // #22
1261
 
    #23,                // #23
1262
 
    #24,                // #24
1263
 
    #25,                // #25
1264
 
    #26,                // #26
1265
 
    #27,                // #27
1266
 
    #28,                // #28
1267
 
    #29,                // #29
1268
 
    #30,                // #30
1269
 
    #31,                // #31
1270
 
    ' ',                // ' '
1271
 
    '!',                // '!'
1272
 
    '"',                // '"'
1273
 
    '#',                // '#'
1274
 
    '$',                // '$'
1275
 
    '%',                // '%'
1276
 
    '&',                // '&'
1277
 
    '''',               // ''''
1278
 
    '(',                // '('
1279
 
    ')',                // ')'
1280
 
    '*',                // '*'
1281
 
    '+',                // '+'
1282
 
    ',',                // ','
1283
 
    '-',                // '-'
1284
 
    '.',                // '.'
1285
 
    '/',                // '/'
1286
 
    '0',                // '0'
1287
 
    '1',                // '1'
1288
 
    '2',                // '2'
1289
 
    '3',                // '3'
1290
 
    '4',                // '4'
1291
 
    '5',                // '5'
1292
 
    '6',                // '6'
1293
 
    '7',                // '7'
1294
 
    '8',                // '8'
1295
 
    '9',                // '9'
1296
 
    ':',                // ':'
1297
 
    ';',                // ';'
1298
 
    '<',                // '<'
1299
 
    '=',                // '='
1300
 
    '>',                // '>'
1301
 
    '?',                // '?'
1302
 
    '@',                // '@'
1303
 
    'A',                // 'A'
1304
 
    'B',                // 'B'
1305
 
    'C',                // 'C'
1306
 
    'D',                // 'D'
1307
 
    'E',                // 'E'
1308
 
    'F',                // 'F'
1309
 
    'G',                // 'G'
1310
 
    'H',                // 'H'
1311
 
    'I',                // 'I'
1312
 
    'J',                // 'J'
1313
 
    'K',                // 'K'
1314
 
    'L',                // 'L'
1315
 
    'M',                // 'M'
1316
 
    'N',                // 'N'
1317
 
    'O',                // 'O'
1318
 
    'P',                // 'P'
1319
 
    'Q',                // 'Q'
1320
 
    'R',                // 'R'
1321
 
    'S',                // 'S'
1322
 
    'T',                // 'T'
1323
 
    'U',                // 'U'
1324
 
    'V',                // 'V'
1325
 
    'W',                // 'W'
1326
 
    'X',                // 'X'
1327
 
    'Y',                // 'Y'
1328
 
    'Z',                // 'Z'
1329
 
    '[',                // '['
1330
 
    '\',                // '\'
1331
 
    ']',                // ']'
1332
 
    '^',                // '^'
1333
 
    '_',                // '_'
1334
 
    '`',                // '`'
1335
 
    'a',                // 'a'
1336
 
    'b',                // 'b'
1337
 
    'c',                // 'c'
1338
 
    'd',                // 'd'
1339
 
    'e',                // 'e'
1340
 
    'f',                // 'f'
1341
 
    'g',                // 'g'
1342
 
    'h',                // 'h'
1343
 
    'i',                // 'i'
1344
 
    'j',                // 'j'
1345
 
    'k',                // 'k'
1346
 
    'l',                // 'l'
1347
 
    'm',                // 'm'
1348
 
    'n',                // 'n'
1349
 
    'o',                // 'o'
1350
 
    'p',                // 'p'
1351
 
    'q',                // 'q'
1352
 
    'r',                // 'r'
1353
 
    's',                // 's'
1354
 
    't',                // 't'
1355
 
    'u',                // 'u'
1356
 
    'v',                // 'v'
1357
 
    'w',                // 'w'
1358
 
    'x',                // 'x'
1359
 
    'y',                // 'y'
1360
 
    'z',                // 'z'
1361
 
    '{',                // '{'
1362
 
    '|',                // '|'
1363
 
    '}',                // '}'
1364
 
    '~',                // '~'
1365
 
    #127,               // #127
1366
 
    #226#130#172,       // #128
1367
 
    '',                 // #129
1368
 
    #226#128#154,       // #130
1369
 
    #198#146,           // #131
1370
 
    #226#128#158,       // #132
1371
 
    #226#128#166,       // #133
1372
 
    #226#128#160,       // #134
1373
 
    #226#128#161,       // #135
1374
 
    #203#134,           // #136
1375
 
    #226#128#176,       // #137
1376
 
    #197#160,           // #138
1377
 
    #226#128#185,       // #139
1378
 
    #197#146,           // #140
1379
 
    '',                 // #141
1380
 
    #197#189,           // #142
1381
 
    '',                 // #143
1382
 
    '',                 // #144
1383
 
    #226#128#152,       // #145
1384
 
    #226#128#153,       // #146
1385
 
    #226#128#156,       // #147
1386
 
    #226#128#157,       // #148
1387
 
    #226#128#162,       // #149
1388
 
    #226#128#147,       // #150
1389
 
    #226#128#148,       // #151
1390
 
    #203#156,           // #152
1391
 
    #226#132#162,       // #153
1392
 
    #197#161,           // #154
1393
 
    #226#128#186,       // #155
1394
 
    #197#147,           // #156
1395
 
    '',                 // #157
1396
 
    #197#190,           // #158
1397
 
    #197#184,           // #159
1398
 
    #194#160,           // #160
1399
 
    #194#161,           // #161
1400
 
    #194#162,           // #162
1401
 
    #194#163,           // #163
1402
 
    #194#164,           // #164
1403
 
    #194#165,           // #165
1404
 
    #194#166,           // #166
1405
 
    #194#167,           // #167
1406
 
    #194#168,           // #168
1407
 
    #194#169,           // #169
1408
 
    #194#170,           // #170
1409
 
    #194#171,           // #171
1410
 
    #194#172,           // #172
1411
 
    #194#173,           // #173
1412
 
    #194#174,           // #174
1413
 
    #194#175,           // #175
1414
 
    #194#176,           // #176
1415
 
    #194#177,           // #177
1416
 
    #194#178,           // #178
1417
 
    #194#179,           // #179
1418
 
    #194#180,           // #180
1419
 
    #194#181,           // #181
1420
 
    #194#182,           // #182
1421
 
    #194#183,           // #183
1422
 
    #194#184,           // #184
1423
 
    #194#185,           // #185
1424
 
    #194#186,           // #186
1425
 
    #194#187,           // #187
1426
 
    #194#188,           // #188
1427
 
    #194#189,           // #189
1428
 
    #194#190,           // #190
1429
 
    #194#191,           // #191
1430
 
    #195#128,           // #192
1431
 
    #195#129,           // #193
1432
 
    #195#130,           // #194
1433
 
    #195#131,           // #195
1434
 
    #195#132,           // #196
1435
 
    #195#133,           // #197
1436
 
    #195#134,           // #198
1437
 
    #195#135,           // #199
1438
 
    #195#136,           // #200
1439
 
    #195#137,           // #201
1440
 
    #195#138,           // #202
1441
 
    #195#139,           // #203
1442
 
    #195#140,           // #204
1443
 
    #195#141,           // #205
1444
 
    #195#142,           // #206
1445
 
    #195#143,           // #207
1446
 
    #195#144,           // #208
1447
 
    #195#145,           // #209
1448
 
    #195#146,           // #210
1449
 
    #195#147,           // #211
1450
 
    #195#148,           // #212
1451
 
    #195#149,           // #213
1452
 
    #195#150,           // #214
1453
 
    #195#151,           // #215
1454
 
    #195#152,           // #216
1455
 
    #195#153,           // #217
1456
 
    #195#154,           // #218
1457
 
    #195#155,           // #219
1458
 
    #195#156,           // #220
1459
 
    #195#157,           // #221
1460
 
    #195#158,           // #222
1461
 
    #195#159,           // #223
1462
 
    #195#160,           // #224
1463
 
    #195#161,           // #225
1464
 
    #195#162,           // #226
1465
 
    #195#163,           // #227
1466
 
    #195#164,           // #228
1467
 
    #195#165,           // #229
1468
 
    #195#166,           // #230
1469
 
    #195#167,           // #231
1470
 
    #195#168,           // #232
1471
 
    #195#169,           // #233
1472
 
    #195#170,           // #234
1473
 
    #195#171,           // #235
1474
 
    #195#172,           // #236
1475
 
    #195#173,           // #237
1476
 
    #195#174,           // #238
1477
 
    #195#175,           // #239
1478
 
    #195#176,           // #240
1479
 
    #195#177,           // #241
1480
 
    #195#178,           // #242
1481
 
    #195#179,           // #243
1482
 
    #195#180,           // #244
1483
 
    #195#181,           // #245
1484
 
    #195#182,           // #246
1485
 
    #195#183,           // #247
1486
 
    #195#184,           // #248
1487
 
    #195#185,           // #249
1488
 
    #195#186,           // #250
1489
 
    #195#187,           // #251
1490
 
    #195#188,           // #252
1491
 
    #195#189,           // #253
1492
 
    #195#190,           // #254
1493
 
    #195#191            // #255
1494
 
  );
1495
 
 
1496
 
  ArrayCP1253ToUTF8: TCharToUTF8Table = (
1497
 
    #0,                 // #0
1498
 
    #1,                 // #1
1499
 
    #2,                 // #2
1500
 
    #3,                 // #3
1501
 
    #4,                 // #4
1502
 
    #5,                 // #5
1503
 
    #6,                 // #6
1504
 
    #7,                 // #7
1505
 
    #8,                 // #8
1506
 
    #9,                 // #9
1507
 
    #10,                // #10
1508
 
    #11,                // #11
1509
 
    #12,                // #12
1510
 
    #13,                // #13
1511
 
    #14,                // #14
1512
 
    #15,                // #15
1513
 
    #16,                // #16
1514
 
    #17,                // #17
1515
 
    #18,                // #18
1516
 
    #19,                // #19
1517
 
    #20,                // #20
1518
 
    #21,                // #21
1519
 
    #22,                // #22
1520
 
    #23,                // #23
1521
 
    #24,                // #24
1522
 
    #25,                // #25
1523
 
    #26,                // #26
1524
 
    #27,                // #27
1525
 
    #28,                // #28
1526
 
    #29,                // #29
1527
 
    #30,                // #30
1528
 
    #31,                // #31
1529
 
    ' ',                // ' '
1530
 
    '!',                // '!'
1531
 
    '"',                // '"'
1532
 
    '#',                // '#'
1533
 
    '$',                // '$'
1534
 
    '%',                // '%'
1535
 
    '&',                // '&'
1536
 
    '''',               // ''''
1537
 
    '(',                // '('
1538
 
    ')',                // ')'
1539
 
    '*',                // '*'
1540
 
    '+',                // '+'
1541
 
    ',',                // ','
1542
 
    '-',                // '-'
1543
 
    '.',                // '.'
1544
 
    '/',                // '/'
1545
 
    '0',                // '0'
1546
 
    '1',                // '1'
1547
 
    '2',                // '2'
1548
 
    '3',                // '3'
1549
 
    '4',                // '4'
1550
 
    '5',                // '5'
1551
 
    '6',                // '6'
1552
 
    '7',                // '7'
1553
 
    '8',                // '8'
1554
 
    '9',                // '9'
1555
 
    ':',                // ':'
1556
 
    ';',                // ';'
1557
 
    '<',                // '<'
1558
 
    '=',                // '='
1559
 
    '>',                // '>'
1560
 
    '?',                // '?'
1561
 
    '@',                // '@'
1562
 
    'A',                // 'A'
1563
 
    'B',                // 'B'
1564
 
    'C',                // 'C'
1565
 
    'D',                // 'D'
1566
 
    'E',                // 'E'
1567
 
    'F',                // 'F'
1568
 
    'G',                // 'G'
1569
 
    'H',                // 'H'
1570
 
    'I',                // 'I'
1571
 
    'J',                // 'J'
1572
 
    'K',                // 'K'
1573
 
    'L',                // 'L'
1574
 
    'M',                // 'M'
1575
 
    'N',                // 'N'
1576
 
    'O',                // 'O'
1577
 
    'P',                // 'P'
1578
 
    'Q',                // 'Q'
1579
 
    'R',                // 'R'
1580
 
    'S',                // 'S'
1581
 
    'T',                // 'T'
1582
 
    'U',                // 'U'
1583
 
    'V',                // 'V'
1584
 
    'W',                // 'W'
1585
 
    'X',                // 'X'
1586
 
    'Y',                // 'Y'
1587
 
    'Z',                // 'Z'
1588
 
    '[',                // '['
1589
 
    '\',                // '\'
1590
 
    ']',                // ']'
1591
 
    '^',                // '^'
1592
 
    '_',                // '_'
1593
 
    '`',                // '`'
1594
 
    'a',                // 'a'
1595
 
    'b',                // 'b'
1596
 
    'c',                // 'c'
1597
 
    'd',                // 'd'
1598
 
    'e',                // 'e'
1599
 
    'f',                // 'f'
1600
 
    'g',                // 'g'
1601
 
    'h',                // 'h'
1602
 
    'i',                // 'i'
1603
 
    'j',                // 'j'
1604
 
    'k',                // 'k'
1605
 
    'l',                // 'l'
1606
 
    'm',                // 'm'
1607
 
    'n',                // 'n'
1608
 
    'o',                // 'o'
1609
 
    'p',                // 'p'
1610
 
    'q',                // 'q'
1611
 
    'r',                // 'r'
1612
 
    's',                // 's'
1613
 
    't',                // 't'
1614
 
    'u',                // 'u'
1615
 
    'v',                // 'v'
1616
 
    'w',                // 'w'
1617
 
    'x',                // 'x'
1618
 
    'y',                // 'y'
1619
 
    'z',                // 'z'
1620
 
    '{',                // '{'
1621
 
    '|',                // '|'
1622
 
    '}',                // '}'
1623
 
    '~',                // '~'
1624
 
    #127,               // #127
1625
 
    #226#130#172,       // #128
1626
 
    '',                 // #129
1627
 
    #226#128#154,       // #130
1628
 
    #198#146,           // #131
1629
 
    #226#128#158,       // #132
1630
 
    #226#128#166,       // #133
1631
 
    #226#128#160,       // #134
1632
 
    #226#128#161,       // #135
1633
 
    '',                 // #136
1634
 
    #226#128#176,       // #137
1635
 
    '',                 // #138
1636
 
    #226#128#185,       // #139
1637
 
    '',                 // #140
1638
 
    '',                 // #141
1639
 
    '',                 // #142
1640
 
    '',                 // #143
1641
 
    '',                 // #144
1642
 
    #226#128#152,       // #145
1643
 
    #226#128#153,       // #146
1644
 
    #226#128#156,       // #147
1645
 
    #226#128#157,       // #148
1646
 
    #226#128#162,       // #149
1647
 
    #226#128#147,       // #150
1648
 
    #226#128#148,       // #151
1649
 
    '',                 // #152
1650
 
    #226#132#162,       // #153
1651
 
    '',                 // #154
1652
 
    #226#128#186,       // #155
1653
 
    '',                 // #156
1654
 
    '',                 // #157
1655
 
    '',                 // #158
1656
 
    '',                 // #159
1657
 
    #194#160,           // #160
1658
 
    #206#133,           // #161
1659
 
    #206#134,           // #162
1660
 
    #194#163,           // #163
1661
 
    #194#164,           // #164
1662
 
    #194#165,           // #165
1663
 
    #194#166,           // #166
1664
 
    #194#167,           // #167
1665
 
    #194#168,           // #168
1666
 
    #194#169,           // #169
1667
 
    '',                 // #170
1668
 
    #194#171,           // #171
1669
 
    #194#172,           // #172
1670
 
    #194#173,           // #173
1671
 
    #194#174,           // #174
1672
 
    #226#128#149,       // #175
1673
 
    #194#176,           // #176
1674
 
    #194#177,           // #177
1675
 
    #194#178,           // #178
1676
 
    #194#179,           // #179
1677
 
    #206#132,           // #180
1678
 
    #194#181,           // #181
1679
 
    #194#182,           // #182
1680
 
    #194#183,           // #183
1681
 
    #206#136,           // #184
1682
 
    #206#137,           // #185
1683
 
    #206#138,           // #186
1684
 
    #194#187,           // #187
1685
 
    #206#140,           // #188
1686
 
    #194#189,           // #189
1687
 
    #206#142,           // #190
1688
 
    #206#143,           // #191
1689
 
    #206#144,           // #192
1690
 
    #206#145,           // #193
1691
 
    #206#146,           // #194
1692
 
    #206#147,           // #195
1693
 
    #206#148,           // #196
1694
 
    #206#149,           // #197
1695
 
    #206#150,           // #198
1696
 
    #206#151,           // #199
1697
 
    #206#152,           // #200
1698
 
    #206#153,           // #201
1699
 
    #206#154,           // #202
1700
 
    #206#155,           // #203
1701
 
    #206#156,           // #204
1702
 
    #206#157,           // #205
1703
 
    #206#158,           // #206
1704
 
    #206#159,           // #207
1705
 
    #206#160,           // #208
1706
 
    #206#161,           // #209
1707
 
    '',                 // #210
1708
 
    #206#163,           // #211
1709
 
    #206#164,           // #212
1710
 
    #206#165,           // #213
1711
 
    #206#166,           // #214
1712
 
    #206#167,           // #215
1713
 
    #206#168,           // #216
1714
 
    #206#169,           // #217
1715
 
    #206#170,           // #218
1716
 
    #206#171,           // #219
1717
 
    #206#172,           // #220
1718
 
    #206#173,           // #221
1719
 
    #206#174,           // #222
1720
 
    #206#175,           // #223
1721
 
    #206#176,           // #224
1722
 
    #206#177,           // #225
1723
 
    #206#178,           // #226
1724
 
    #206#179,           // #227
1725
 
    #206#180,           // #228
1726
 
    #206#181,           // #229
1727
 
    #206#182,           // #230
1728
 
    #206#183,           // #231
1729
 
    #206#184,           // #232
1730
 
    #206#185,           // #233
1731
 
    #206#186,           // #234
1732
 
    #206#187,           // #235
1733
 
    #206#188,           // #236
1734
 
    #206#189,           // #237
1735
 
    #206#190,           // #238
1736
 
    #206#191,           // #239
1737
 
    #207#128,           // #240
1738
 
    #207#129,           // #241
1739
 
    #207#130,           // #242
1740
 
    #207#131,           // #243
1741
 
    #207#132,           // #244
1742
 
    #207#133,           // #245
1743
 
    #207#134,           // #246
1744
 
    #207#135,           // #247
1745
 
    #207#136,           // #248
1746
 
    #207#137,           // #249
1747
 
    #207#138,           // #250
1748
 
    #207#139,           // #251
1749
 
    #207#140,           // #252
1750
 
    #207#141,           // #253
1751
 
    #207#142,           // #254
1752
 
    ''                  // #255
1753
 
  );
1754
 
 
1755
 
  ArrayCP1254ToUTF8: TCharToUTF8Table = (
1756
 
    #0,                 // #0
1757
 
    #1,                 // #1
1758
 
    #2,                 // #2
1759
 
    #3,                 // #3
1760
 
    #4,                 // #4
1761
 
    #5,                 // #5
1762
 
    #6,                 // #6
1763
 
    #7,                 // #7
1764
 
    #8,                 // #8
1765
 
    #9,                 // #9
1766
 
    #10,                // #10
1767
 
    #11,                // #11
1768
 
    #12,                // #12
1769
 
    #13,                // #13
1770
 
    #14,                // #14
1771
 
    #15,                // #15
1772
 
    #16,                // #16
1773
 
    #17,                // #17
1774
 
    #18,                // #18
1775
 
    #19,                // #19
1776
 
    #20,                // #20
1777
 
    #21,                // #21
1778
 
    #22,                // #22
1779
 
    #23,                // #23
1780
 
    #24,                // #24
1781
 
    #25,                // #25
1782
 
    #26,                // #26
1783
 
    #27,                // #27
1784
 
    #28,                // #28
1785
 
    #29,                // #29
1786
 
    #30,                // #30
1787
 
    #31,                // #31
1788
 
    ' ',                // ' '
1789
 
    '!',                // '!'
1790
 
    '"',                // '"'
1791
 
    '#',                // '#'
1792
 
    '$',                // '$'
1793
 
    '%',                // '%'
1794
 
    '&',                // '&'
1795
 
    '''',               // ''''
1796
 
    '(',                // '('
1797
 
    ')',                // ')'
1798
 
    '*',                // '*'
1799
 
    '+',                // '+'
1800
 
    ',',                // ','
1801
 
    '-',                // '-'
1802
 
    '.',                // '.'
1803
 
    '/',                // '/'
1804
 
    '0',                // '0'
1805
 
    '1',                // '1'
1806
 
    '2',                // '2'
1807
 
    '3',                // '3'
1808
 
    '4',                // '4'
1809
 
    '5',                // '5'
1810
 
    '6',                // '6'
1811
 
    '7',                // '7'
1812
 
    '8',                // '8'
1813
 
    '9',                // '9'
1814
 
    ':',                // ':'
1815
 
    ';',                // ';'
1816
 
    '<',                // '<'
1817
 
    '=',                // '='
1818
 
    '>',                // '>'
1819
 
    '?',                // '?'
1820
 
    '@',                // '@'
1821
 
    'A',                // 'A'
1822
 
    'B',                // 'B'
1823
 
    'C',                // 'C'
1824
 
    'D',                // 'D'
1825
 
    'E',                // 'E'
1826
 
    'F',                // 'F'
1827
 
    'G',                // 'G'
1828
 
    'H',                // 'H'
1829
 
    'I',                // 'I'
1830
 
    'J',                // 'J'
1831
 
    'K',                // 'K'
1832
 
    'L',                // 'L'
1833
 
    'M',                // 'M'
1834
 
    'N',                // 'N'
1835
 
    'O',                // 'O'
1836
 
    'P',                // 'P'
1837
 
    'Q',                // 'Q'
1838
 
    'R',                // 'R'
1839
 
    'S',                // 'S'
1840
 
    'T',                // 'T'
1841
 
    'U',                // 'U'
1842
 
    'V',                // 'V'
1843
 
    'W',                // 'W'
1844
 
    'X',                // 'X'
1845
 
    'Y',                // 'Y'
1846
 
    'Z',                // 'Z'
1847
 
    '[',                // '['
1848
 
    '\',                // '\'
1849
 
    ']',                // ']'
1850
 
    '^',                // '^'
1851
 
    '_',                // '_'
1852
 
    '`',                // '`'
1853
 
    'a',                // 'a'
1854
 
    'b',                // 'b'
1855
 
    'c',                // 'c'
1856
 
    'd',                // 'd'
1857
 
    'e',                // 'e'
1858
 
    'f',                // 'f'
1859
 
    'g',                // 'g'
1860
 
    'h',                // 'h'
1861
 
    'i',                // 'i'
1862
 
    'j',                // 'j'
1863
 
    'k',                // 'k'
1864
 
    'l',                // 'l'
1865
 
    'm',                // 'm'
1866
 
    'n',                // 'n'
1867
 
    'o',                // 'o'
1868
 
    'p',                // 'p'
1869
 
    'q',                // 'q'
1870
 
    'r',                // 'r'
1871
 
    's',                // 's'
1872
 
    't',                // 't'
1873
 
    'u',                // 'u'
1874
 
    'v',                // 'v'
1875
 
    'w',                // 'w'
1876
 
    'x',                // 'x'
1877
 
    'y',                // 'y'
1878
 
    'z',                // 'z'
1879
 
    '{',                // '{'
1880
 
    '|',                // '|'
1881
 
    '}',                // '}'
1882
 
    '~',                // '~'
1883
 
    #127,               // #127
1884
 
    #226#130#172,       // #128
1885
 
    '',                 // #129
1886
 
    #226#128#154,       // #130
1887
 
    #198#146,           // #131
1888
 
    #226#128#158,       // #132
1889
 
    #226#128#166,       // #133
1890
 
    #226#128#160,       // #134
1891
 
    #226#128#161,       // #135
1892
 
    #203#134,           // #136
1893
 
    #226#128#176,       // #137
1894
 
    #197#160,           // #138
1895
 
    #226#128#185,       // #139
1896
 
    #197#146,           // #140
1897
 
    '',                 // #141
1898
 
    '',                 // #142
1899
 
    '',                 // #143
1900
 
    '',                 // #144
1901
 
    #226#128#152,       // #145
1902
 
    #226#128#153,       // #146
1903
 
    #226#128#156,       // #147
1904
 
    #226#128#157,       // #148
1905
 
    #226#128#162,       // #149
1906
 
    #226#128#147,       // #150
1907
 
    #226#128#148,       // #151
1908
 
    #203#156,           // #152
1909
 
    #226#132#162,       // #153
1910
 
    #197#161,           // #154
1911
 
    #226#128#186,       // #155
1912
 
    #197#147,           // #156
1913
 
    '',                 // #157
1914
 
    '',                 // #158
1915
 
    #197#184,           // #159
1916
 
    #194#160,           // #160
1917
 
    #194#161,           // #161
1918
 
    #194#162,           // #162
1919
 
    #194#163,           // #163
1920
 
    #194#164,           // #164
1921
 
    #194#165,           // #165
1922
 
    #194#166,           // #166
1923
 
    #194#167,           // #167
1924
 
    #194#168,           // #168
1925
 
    #194#169,           // #169
1926
 
    #194#170,           // #170
1927
 
    #194#171,           // #171
1928
 
    #194#172,           // #172
1929
 
    #194#173,           // #173
1930
 
    #194#174,           // #174
1931
 
    #194#175,           // #175
1932
 
    #194#176,           // #176
1933
 
    #194#177,           // #177
1934
 
    #194#178,           // #178
1935
 
    #194#179,           // #179
1936
 
    #194#180,           // #180
1937
 
    #194#181,           // #181
1938
 
    #194#182,           // #182
1939
 
    #194#183,           // #183
1940
 
    #194#184,           // #184
1941
 
    #194#185,           // #185
1942
 
    #194#186,           // #186
1943
 
    #194#187,           // #187
1944
 
    #194#188,           // #188
1945
 
    #194#189,           // #189
1946
 
    #194#190,           // #190
1947
 
    #194#191,           // #191
1948
 
    #195#128,           // #192
1949
 
    #195#129,           // #193
1950
 
    #195#130,           // #194
1951
 
    #195#131,           // #195
1952
 
    #195#132,           // #196
1953
 
    #195#133,           // #197
1954
 
    #195#134,           // #198
1955
 
    #195#135,           // #199
1956
 
    #195#136,           // #200
1957
 
    #195#137,           // #201
1958
 
    #195#138,           // #202
1959
 
    #195#139,           // #203
1960
 
    #195#140,           // #204
1961
 
    #195#141,           // #205
1962
 
    #195#142,           // #206
1963
 
    #195#143,           // #207
1964
 
    #196#158,           // #208
1965
 
    #195#145,           // #209
1966
 
    #195#146,           // #210
1967
 
    #195#147,           // #211
1968
 
    #195#148,           // #212
1969
 
    #195#149,           // #213
1970
 
    #195#150,           // #214
1971
 
    #195#151,           // #215
1972
 
    #195#152,           // #216
1973
 
    #195#153,           // #217
1974
 
    #195#154,           // #218
1975
 
    #195#155,           // #219
1976
 
    #195#156,           // #220
1977
 
    #196#176,           // #221
1978
 
    #197#158,           // #222
1979
 
    #195#159,           // #223
1980
 
    #195#160,           // #224
1981
 
    #195#161,           // #225
1982
 
    #195#162,           // #226
1983
 
    #195#163,           // #227
1984
 
    #195#164,           // #228
1985
 
    #195#165,           // #229
1986
 
    #195#166,           // #230
1987
 
    #195#167,           // #231
1988
 
    #195#168,           // #232
1989
 
    #195#169,           // #233
1990
 
    #195#170,           // #234
1991
 
    #195#171,           // #235
1992
 
    #195#172,           // #236
1993
 
    #195#173,           // #237
1994
 
    #195#174,           // #238
1995
 
    #195#175,           // #239
1996
 
    #196#159,           // #240
1997
 
    #195#177,           // #241
1998
 
    #195#178,           // #242
1999
 
    #195#179,           // #243
2000
 
    #195#180,           // #244
2001
 
    #195#181,           // #245
2002
 
    #195#182,           // #246
2003
 
    #195#183,           // #247
2004
 
    #195#184,           // #248
2005
 
    #195#185,           // #249
2006
 
    #195#186,           // #250
2007
 
    #195#187,           // #251
2008
 
    #195#188,           // #252
2009
 
    #196#177,           // #253
2010
 
    #197#159,           // #254
2011
 
    #195#191            // #255
2012
 
  );
2013
 
 
2014
 
  ArrayCP1255ToUTF8: TCharToUTF8Table = (
2015
 
    #0,                 // #0
2016
 
    #1,                 // #1
2017
 
    #2,                 // #2
2018
 
    #3,                 // #3
2019
 
    #4,                 // #4
2020
 
    #5,                 // #5
2021
 
    #6,                 // #6
2022
 
    #7,                 // #7
2023
 
    #8,                 // #8
2024
 
    #9,                 // #9
2025
 
    #10,                // #10
2026
 
    #11,                // #11
2027
 
    #12,                // #12
2028
 
    #13,                // #13
2029
 
    #14,                // #14
2030
 
    #15,                // #15
2031
 
    #16,                // #16
2032
 
    #17,                // #17
2033
 
    #18,                // #18
2034
 
    #19,                // #19
2035
 
    #20,                // #20
2036
 
    #21,                // #21
2037
 
    #22,                // #22
2038
 
    #23,                // #23
2039
 
    #24,                // #24
2040
 
    #25,                // #25
2041
 
    #26,                // #26
2042
 
    #27,                // #27
2043
 
    #28,                // #28
2044
 
    #29,                // #29
2045
 
    #30,                // #30
2046
 
    #31,                // #31
2047
 
    ' ',                // ' '
2048
 
    '!',                // '!'
2049
 
    '"',                // '"'
2050
 
    '#',                // '#'
2051
 
    '$',                // '$'
2052
 
    '%',                // '%'
2053
 
    '&',                // '&'
2054
 
    '''',               // ''''
2055
 
    '(',                // '('
2056
 
    ')',                // ')'
2057
 
    '*',                // '*'
2058
 
    '+',                // '+'
2059
 
    ',',                // ','
2060
 
    '-',                // '-'
2061
 
    '.',                // '.'
2062
 
    '/',                // '/'
2063
 
    '0',                // '0'
2064
 
    '1',                // '1'
2065
 
    '2',                // '2'
2066
 
    '3',                // '3'
2067
 
    '4',                // '4'
2068
 
    '5',                // '5'
2069
 
    '6',                // '6'
2070
 
    '7',                // '7'
2071
 
    '8',                // '8'
2072
 
    '9',                // '9'
2073
 
    ':',                // ':'
2074
 
    ';',                // ';'
2075
 
    '<',                // '<'
2076
 
    '=',                // '='
2077
 
    '>',                // '>'
2078
 
    '?',                // '?'
2079
 
    '@',                // '@'
2080
 
    'A',                // 'A'
2081
 
    'B',                // 'B'
2082
 
    'C',                // 'C'
2083
 
    'D',                // 'D'
2084
 
    'E',                // 'E'
2085
 
    'F',                // 'F'
2086
 
    'G',                // 'G'
2087
 
    'H',                // 'H'
2088
 
    'I',                // 'I'
2089
 
    'J',                // 'J'
2090
 
    'K',                // 'K'
2091
 
    'L',                // 'L'
2092
 
    'M',                // 'M'
2093
 
    'N',                // 'N'
2094
 
    'O',                // 'O'
2095
 
    'P',                // 'P'
2096
 
    'Q',                // 'Q'
2097
 
    'R',                // 'R'
2098
 
    'S',                // 'S'
2099
 
    'T',                // 'T'
2100
 
    'U',                // 'U'
2101
 
    'V',                // 'V'
2102
 
    'W',                // 'W'
2103
 
    'X',                // 'X'
2104
 
    'Y',                // 'Y'
2105
 
    'Z',                // 'Z'
2106
 
    '[',                // '['
2107
 
    '\',                // '\'
2108
 
    ']',                // ']'
2109
 
    '^',                // '^'
2110
 
    '_',                // '_'
2111
 
    '`',                // '`'
2112
 
    'a',                // 'a'
2113
 
    'b',                // 'b'
2114
 
    'c',                // 'c'
2115
 
    'd',                // 'd'
2116
 
    'e',                // 'e'
2117
 
    'f',                // 'f'
2118
 
    'g',                // 'g'
2119
 
    'h',                // 'h'
2120
 
    'i',                // 'i'
2121
 
    'j',                // 'j'
2122
 
    'k',                // 'k'
2123
 
    'l',                // 'l'
2124
 
    'm',                // 'm'
2125
 
    'n',                // 'n'
2126
 
    'o',                // 'o'
2127
 
    'p',                // 'p'
2128
 
    'q',                // 'q'
2129
 
    'r',                // 'r'
2130
 
    's',                // 's'
2131
 
    't',                // 't'
2132
 
    'u',                // 'u'
2133
 
    'v',                // 'v'
2134
 
    'w',                // 'w'
2135
 
    'x',                // 'x'
2136
 
    'y',                // 'y'
2137
 
    'z',                // 'z'
2138
 
    '{',                // '{'
2139
 
    '|',                // '|'
2140
 
    '}',                // '}'
2141
 
    '~',                // '~'
2142
 
    #127,               // #127
2143
 
    #226#130#172,       // #128
2144
 
    '',                 // #129
2145
 
    #226#128#154,       // #130
2146
 
    #198#146,           // #131
2147
 
    #226#128#158,       // #132
2148
 
    #226#128#166,       // #133
2149
 
    #226#128#160,       // #134
2150
 
    #226#128#161,       // #135
2151
 
    #203#134,           // #136
2152
 
    #226#128#176,       // #137
2153
 
    '',                 // #138
2154
 
    #226#128#185,       // #139
2155
 
    '',                 // #140
2156
 
    '',                 // #141
2157
 
    '',                 // #142
2158
 
    '',                 // #143
2159
 
    '',                 // #144
2160
 
    #226#128#152,       // #145
2161
 
    #226#128#153,       // #146
2162
 
    #226#128#156,       // #147
2163
 
    #226#128#157,       // #148
2164
 
    #226#128#162,       // #149
2165
 
    #226#128#147,       // #150
2166
 
    #226#128#148,       // #151
2167
 
    #203#156,           // #152
2168
 
    #226#132#162,       // #153
2169
 
    '',                 // #154
2170
 
    #226#128#186,       // #155
2171
 
    '',                 // #156
2172
 
    '',                 // #157
2173
 
    '',                 // #158
2174
 
    '',                 // #159
2175
 
    #194#160,           // #160
2176
 
    #194#161,           // #161
2177
 
    #194#162,           // #162
2178
 
    #194#163,           // #163
2179
 
    #226#130#170,       // #164
2180
 
    #194#165,           // #165
2181
 
    #194#166,           // #166
2182
 
    #194#167,           // #167
2183
 
    #194#168,           // #168
2184
 
    #194#169,           // #169
2185
 
    #195#151,           // #170
2186
 
    #194#171,           // #171
2187
 
    #194#172,           // #172
2188
 
    #194#173,           // #173
2189
 
    #194#174,           // #174
2190
 
    #194#175,           // #175
2191
 
    #194#176,           // #176
2192
 
    #194#177,           // #177
2193
 
    #194#178,           // #178
2194
 
    #194#179,           // #179
2195
 
    #194#180,           // #180
2196
 
    #194#181,           // #181
2197
 
    #194#182,           // #182
2198
 
    #194#183,           // #183
2199
 
    #194#184,           // #184
2200
 
    #194#185,           // #185
2201
 
    #195#183,           // #186
2202
 
    #194#187,           // #187
2203
 
    #194#188,           // #188
2204
 
    #194#189,           // #189
2205
 
    #194#190,           // #190
2206
 
    #194#191,           // #191
2207
 
    #214#176,           // #192
2208
 
    #214#177,           // #193
2209
 
    #214#178,           // #194
2210
 
    #214#179,           // #195
2211
 
    #214#180,           // #196
2212
 
    #214#181,           // #197
2213
 
    #214#182,           // #198
2214
 
    #214#183,           // #199
2215
 
    #214#184,           // #200
2216
 
    #214#185,           // #201
2217
 
    '',                 // #202
2218
 
    #214#187,           // #203
2219
 
    #214#188,           // #204
2220
 
    #214#189,           // #205
2221
 
    #214#190,           // #206
2222
 
    #214#191,           // #207
2223
 
    #215#128,           // #208
2224
 
    #215#129,           // #209
2225
 
    #215#130,           // #210
2226
 
    #215#131,           // #211
2227
 
    #215#176,           // #212
2228
 
    #215#177,           // #213
2229
 
    #215#178,           // #214
2230
 
    #215#179,           // #215
2231
 
    #215#180,           // #216
2232
 
    '',                 // #217
2233
 
    '',                 // #218
2234
 
    '',                 // #219
2235
 
    '',                 // #220
2236
 
    '',                 // #221
2237
 
    '',                 // #222
2238
 
    '',                 // #223
2239
 
    #215#144,           // #224
2240
 
    #215#145,           // #225
2241
 
    #215#146,           // #226
2242
 
    #215#147,           // #227
2243
 
    #215#148,           // #228
2244
 
    #215#149,           // #229
2245
 
    #215#150,           // #230
2246
 
    #215#151,           // #231
2247
 
    #215#152,           // #232
2248
 
    #215#153,           // #233
2249
 
    #215#154,           // #234
2250
 
    #215#155,           // #235
2251
 
    #215#156,           // #236
2252
 
    #215#157,           // #237
2253
 
    #215#158,           // #238
2254
 
    #215#159,           // #239
2255
 
    #215#160,           // #240
2256
 
    #215#161,           // #241
2257
 
    #215#162,           // #242
2258
 
    #215#163,           // #243
2259
 
    #215#164,           // #244
2260
 
    #215#165,           // #245
2261
 
    #215#166,           // #246
2262
 
    #215#167,           // #247
2263
 
    #215#168,           // #248
2264
 
    #215#169,           // #249
2265
 
    #215#170,           // #250
2266
 
    '',                 // #251
2267
 
    '',                 // #252
2268
 
    #226#128#142,       // #253
2269
 
    #226#128#143,       // #254
2270
 
    ''                  // #255
2271
 
  );
2272
 
 
2273
 
  ArrayCP1256ToUTF8: TCharToUTF8Table = (
2274
 
    #0,                 // #0
2275
 
    #1,                 // #1
2276
 
    #2,                 // #2
2277
 
    #3,                 // #3
2278
 
    #4,                 // #4
2279
 
    #5,                 // #5
2280
 
    #6,                 // #6
2281
 
    #7,                 // #7
2282
 
    #8,                 // #8
2283
 
    #9,                 // #9
2284
 
    #10,                // #10
2285
 
    #11,                // #11
2286
 
    #12,                // #12
2287
 
    #13,                // #13
2288
 
    #14,                // #14
2289
 
    #15,                // #15
2290
 
    #16,                // #16
2291
 
    #17,                // #17
2292
 
    #18,                // #18
2293
 
    #19,                // #19
2294
 
    #20,                // #20
2295
 
    #21,                // #21
2296
 
    #22,                // #22
2297
 
    #23,                // #23
2298
 
    #24,                // #24
2299
 
    #25,                // #25
2300
 
    #26,                // #26
2301
 
    #27,                // #27
2302
 
    #28,                // #28
2303
 
    #29,                // #29
2304
 
    #30,                // #30
2305
 
    #31,                // #31
2306
 
    ' ',                // ' '
2307
 
    '!',                // '!'
2308
 
    '"',                // '"'
2309
 
    '#',                // '#'
2310
 
    '$',                // '$'
2311
 
    '%',                // '%'
2312
 
    '&',                // '&'
2313
 
    '''',               // ''''
2314
 
    '(',                // '('
2315
 
    ')',                // ')'
2316
 
    '*',                // '*'
2317
 
    '+',                // '+'
2318
 
    ',',                // ','
2319
 
    '-',                // '-'
2320
 
    '.',                // '.'
2321
 
    '/',                // '/'
2322
 
    '0',                // '0'
2323
 
    '1',                // '1'
2324
 
    '2',                // '2'
2325
 
    '3',                // '3'
2326
 
    '4',                // '4'
2327
 
    '5',                // '5'
2328
 
    '6',                // '6'
2329
 
    '7',                // '7'
2330
 
    '8',                // '8'
2331
 
    '9',                // '9'
2332
 
    ':',                // ':'
2333
 
    ';',                // ';'
2334
 
    '<',                // '<'
2335
 
    '=',                // '='
2336
 
    '>',                // '>'
2337
 
    '?',                // '?'
2338
 
    '@',                // '@'
2339
 
    'A',                // 'A'
2340
 
    'B',                // 'B'
2341
 
    'C',                // 'C'
2342
 
    'D',                // 'D'
2343
 
    'E',                // 'E'
2344
 
    'F',                // 'F'
2345
 
    'G',                // 'G'
2346
 
    'H',                // 'H'
2347
 
    'I',                // 'I'
2348
 
    'J',                // 'J'
2349
 
    'K',                // 'K'
2350
 
    'L',                // 'L'
2351
 
    'M',                // 'M'
2352
 
    'N',                // 'N'
2353
 
    'O',                // 'O'
2354
 
    'P',                // 'P'
2355
 
    'Q',                // 'Q'
2356
 
    'R',                // 'R'
2357
 
    'S',                // 'S'
2358
 
    'T',                // 'T'
2359
 
    'U',                // 'U'
2360
 
    'V',                // 'V'
2361
 
    'W',                // 'W'
2362
 
    'X',                // 'X'
2363
 
    'Y',                // 'Y'
2364
 
    'Z',                // 'Z'
2365
 
    '[',                // '['
2366
 
    '\',                // '\'
2367
 
    ']',                // ']'
2368
 
    '^',                // '^'
2369
 
    '_',                // '_'
2370
 
    '`',                // '`'
2371
 
    'a',                // 'a'
2372
 
    'b',                // 'b'
2373
 
    'c',                // 'c'
2374
 
    'd',                // 'd'
2375
 
    'e',                // 'e'
2376
 
    'f',                // 'f'
2377
 
    'g',                // 'g'
2378
 
    'h',                // 'h'
2379
 
    'i',                // 'i'
2380
 
    'j',                // 'j'
2381
 
    'k',                // 'k'
2382
 
    'l',                // 'l'
2383
 
    'm',                // 'm'
2384
 
    'n',                // 'n'
2385
 
    'o',                // 'o'
2386
 
    'p',                // 'p'
2387
 
    'q',                // 'q'
2388
 
    'r',                // 'r'
2389
 
    's',                // 's'
2390
 
    't',                // 't'
2391
 
    'u',                // 'u'
2392
 
    'v',                // 'v'
2393
 
    'w',                // 'w'
2394
 
    'x',                // 'x'
2395
 
    'y',                // 'y'
2396
 
    'z',                // 'z'
2397
 
    '{',                // '{'
2398
 
    '|',                // '|'
2399
 
    '}',                // '}'
2400
 
    '~',                // '~'
2401
 
    #127,               // #127
2402
 
    #226#130#172,       // #128
2403
 
    #217#190,           // #129
2404
 
    #226#128#154,       // #130
2405
 
    #198#146,           // #131
2406
 
    #226#128#158,       // #132
2407
 
    #226#128#166,       // #133
2408
 
    #226#128#160,       // #134
2409
 
    #226#128#161,       // #135
2410
 
    #203#134,           // #136
2411
 
    #226#128#176,       // #137
2412
 
    #217#185,           // #138
2413
 
    #226#128#185,       // #139
2414
 
    #197#146,           // #140
2415
 
    #218#134,           // #141
2416
 
    #218#152,           // #142
2417
 
    #218#136,           // #143
2418
 
    #218#175,           // #144
2419
 
    #226#128#152,       // #145
2420
 
    #226#128#153,       // #146
2421
 
    #226#128#156,       // #147
2422
 
    #226#128#157,       // #148
2423
 
    #226#128#162,       // #149
2424
 
    #226#128#147,       // #150
2425
 
    #226#128#148,       // #151
2426
 
    #218#169,           // #152
2427
 
    #226#132#162,       // #153
2428
 
    #218#145,           // #154
2429
 
    #226#128#186,       // #155
2430
 
    #197#147,           // #156
2431
 
    #226#128#140,       // #157
2432
 
    #226#128#141,       // #158
2433
 
    #218#186,           // #159
2434
 
    #194#160,           // #160
2435
 
    #216#140,           // #161
2436
 
    #194#162,           // #162
2437
 
    #194#163,           // #163
2438
 
    #194#164,           // #164
2439
 
    #194#165,           // #165
2440
 
    #194#166,           // #166
2441
 
    #194#167,           // #167
2442
 
    #194#168,           // #168
2443
 
    #194#169,           // #169
2444
 
    #218#190,           // #170
2445
 
    #194#171,           // #171
2446
 
    #194#172,           // #172
2447
 
    #194#173,           // #173
2448
 
    #194#174,           // #174
2449
 
    #194#175,           // #175
2450
 
    #194#176,           // #176
2451
 
    #194#177,           // #177
2452
 
    #194#178,           // #178
2453
 
    #194#179,           // #179
2454
 
    #194#180,           // #180
2455
 
    #194#181,           // #181
2456
 
    #194#182,           // #182
2457
 
    #194#183,           // #183
2458
 
    #194#184,           // #184
2459
 
    #194#185,           // #185
2460
 
    #216#155,           // #186
2461
 
    #194#187,           // #187
2462
 
    #194#188,           // #188
2463
 
    #194#189,           // #189
2464
 
    #194#190,           // #190
2465
 
    #216#159,           // #191
2466
 
    #219#129,           // #192
2467
 
    #216#161,           // #193
2468
 
    #216#162,           // #194
2469
 
    #216#163,           // #195
2470
 
    #216#164,           // #196
2471
 
    #216#165,           // #197
2472
 
    #216#166,           // #198
2473
 
    #216#167,           // #199
2474
 
    #216#168,           // #200
2475
 
    #216#169,           // #201
2476
 
    #216#170,           // #202
2477
 
    #216#171,           // #203
2478
 
    #216#172,           // #204
2479
 
    #216#173,           // #205
2480
 
    #216#174,           // #206
2481
 
    #216#175,           // #207
2482
 
    #216#176,           // #208
2483
 
    #216#177,           // #209
2484
 
    #216#178,           // #210
2485
 
    #216#179,           // #211
2486
 
    #216#180,           // #212
2487
 
    #216#181,           // #213
2488
 
    #216#182,           // #214
2489
 
    #195#151,           // #215
2490
 
    #216#183,           // #216
2491
 
    #216#184,           // #217
2492
 
    #216#185,           // #218
2493
 
    #216#186,           // #219
2494
 
    #217#128,           // #220
2495
 
    #217#129,           // #221
2496
 
    #217#130,           // #222
2497
 
    #217#131,           // #223
2498
 
    #195#160,           // #224
2499
 
    #217#132,           // #225
2500
 
    #195#162,           // #226
2501
 
    #217#133,           // #227
2502
 
    #217#134,           // #228
2503
 
    #217#135,           // #229
2504
 
    #217#136,           // #230
2505
 
    #195#167,           // #231
2506
 
    #195#168,           // #232
2507
 
    #195#169,           // #233
2508
 
    #195#170,           // #234
2509
 
    #195#171,           // #235
2510
 
    #217#137,           // #236
2511
 
    #217#138,           // #237
2512
 
    #195#174,           // #238
2513
 
    #195#175,           // #239
2514
 
    #217#139,           // #240
2515
 
    #217#140,           // #241
2516
 
    #217#141,           // #242
2517
 
    #217#142,           // #243
2518
 
    #195#180,           // #244
2519
 
    #217#143,           // #245
2520
 
    #217#144,           // #246
2521
 
    #195#183,           // #247
2522
 
    #217#145,           // #248
2523
 
    #195#185,           // #249
2524
 
    #217#146,           // #250
2525
 
    #195#187,           // #251
2526
 
    #195#188,           // #252
2527
 
    #226#128#142,       // #253
2528
 
    #226#128#143,       // #254
2529
 
    #219#146            // #255
2530
 
  );
2531
 
 
2532
 
  ArrayCP1257ToUTF8: TCharToUTF8Table = (
2533
 
    #0,                 // #0
2534
 
    #1,                 // #1
2535
 
    #2,                 // #2
2536
 
    #3,                 // #3
2537
 
    #4,                 // #4
2538
 
    #5,                 // #5
2539
 
    #6,                 // #6
2540
 
    #7,                 // #7
2541
 
    #8,                 // #8
2542
 
    #9,                 // #9
2543
 
    #10,                // #10
2544
 
    #11,                // #11
2545
 
    #12,                // #12
2546
 
    #13,                // #13
2547
 
    #14,                // #14
2548
 
    #15,                // #15
2549
 
    #16,                // #16
2550
 
    #17,                // #17
2551
 
    #18,                // #18
2552
 
    #19,                // #19
2553
 
    #20,                // #20
2554
 
    #21,                // #21
2555
 
    #22,                // #22
2556
 
    #23,                // #23
2557
 
    #24,                // #24
2558
 
    #25,                // #25
2559
 
    #26,                // #26
2560
 
    #27,                // #27
2561
 
    #28,                // #28
2562
 
    #29,                // #29
2563
 
    #30,                // #30
2564
 
    #31,                // #31
2565
 
    ' ',                // ' '
2566
 
    '!',                // '!'
2567
 
    '"',                // '"'
2568
 
    '#',                // '#'
2569
 
    '$',                // '$'
2570
 
    '%',                // '%'
2571
 
    '&',                // '&'
2572
 
    '''',               // ''''
2573
 
    '(',                // '('
2574
 
    ')',                // ')'
2575
 
    '*',                // '*'
2576
 
    '+',                // '+'
2577
 
    ',',                // ','
2578
 
    '-',                // '-'
2579
 
    '.',                // '.'
2580
 
    '/',                // '/'
2581
 
    '0',                // '0'
2582
 
    '1',                // '1'
2583
 
    '2',                // '2'
2584
 
    '3',                // '3'
2585
 
    '4',                // '4'
2586
 
    '5',                // '5'
2587
 
    '6',                // '6'
2588
 
    '7',                // '7'
2589
 
    '8',                // '8'
2590
 
    '9',                // '9'
2591
 
    ':',                // ':'
2592
 
    ';',                // ';'
2593
 
    '<',                // '<'
2594
 
    '=',                // '='
2595
 
    '>',                // '>'
2596
 
    '?',                // '?'
2597
 
    '@',                // '@'
2598
 
    'A',                // 'A'
2599
 
    'B',                // 'B'
2600
 
    'C',                // 'C'
2601
 
    'D',                // 'D'
2602
 
    'E',                // 'E'
2603
 
    'F',                // 'F'
2604
 
    'G',                // 'G'
2605
 
    'H',                // 'H'
2606
 
    'I',                // 'I'
2607
 
    'J',                // 'J'
2608
 
    'K',                // 'K'
2609
 
    'L',                // 'L'
2610
 
    'M',                // 'M'
2611
 
    'N',                // 'N'
2612
 
    'O',                // 'O'
2613
 
    'P',                // 'P'
2614
 
    'Q',                // 'Q'
2615
 
    'R',                // 'R'
2616
 
    'S',                // 'S'
2617
 
    'T',                // 'T'
2618
 
    'U',                // 'U'
2619
 
    'V',                // 'V'
2620
 
    'W',                // 'W'
2621
 
    'X',                // 'X'
2622
 
    'Y',                // 'Y'
2623
 
    'Z',                // 'Z'
2624
 
    '[',                // '['
2625
 
    '\',                // '\'
2626
 
    ']',                // ']'
2627
 
    '^',                // '^'
2628
 
    '_',                // '_'
2629
 
    '`',                // '`'
2630
 
    'a',                // 'a'
2631
 
    'b',                // 'b'
2632
 
    'c',                // 'c'
2633
 
    'd',                // 'd'
2634
 
    'e',                // 'e'
2635
 
    'f',                // 'f'
2636
 
    'g',                // 'g'
2637
 
    'h',                // 'h'
2638
 
    'i',                // 'i'
2639
 
    'j',                // 'j'
2640
 
    'k',                // 'k'
2641
 
    'l',                // 'l'
2642
 
    'm',                // 'm'
2643
 
    'n',                // 'n'
2644
 
    'o',                // 'o'
2645
 
    'p',                // 'p'
2646
 
    'q',                // 'q'
2647
 
    'r',                // 'r'
2648
 
    's',                // 's'
2649
 
    't',                // 't'
2650
 
    'u',                // 'u'
2651
 
    'v',                // 'v'
2652
 
    'w',                // 'w'
2653
 
    'x',                // 'x'
2654
 
    'y',                // 'y'
2655
 
    'z',                // 'z'
2656
 
    '{',                // '{'
2657
 
    '|',                // '|'
2658
 
    '}',                // '}'
2659
 
    '~',                // '~'
2660
 
    #127,               // #127
2661
 
    #226#130#172,       // #128
2662
 
    '',                 // #129
2663
 
    #226#128#154,       // #130
2664
 
    '',                 // #131
2665
 
    #226#128#158,       // #132
2666
 
    #226#128#166,       // #133
2667
 
    #226#128#160,       // #134
2668
 
    #226#128#161,       // #135
2669
 
    '',                 // #136
2670
 
    #226#128#176,       // #137
2671
 
    '',                 // #138
2672
 
    #226#128#185,       // #139
2673
 
    '',                 // #140
2674
 
    #194#168,           // #141
2675
 
    #203#135,           // #142
2676
 
    #194#184,           // #143
2677
 
    '',                 // #144
2678
 
    #226#128#152,       // #145
2679
 
    #226#128#153,       // #146
2680
 
    #226#128#156,       // #147
2681
 
    #226#128#157,       // #148
2682
 
    #226#128#162,       // #149
2683
 
    #226#128#147,       // #150
2684
 
    #226#128#148,       // #151
2685
 
    '',                 // #152
2686
 
    #226#132#162,       // #153
2687
 
    '',                 // #154
2688
 
    #226#128#186,       // #155
2689
 
    '',                 // #156
2690
 
    #194#175,           // #157
2691
 
    #203#155,           // #158
2692
 
    '',                 // #159
2693
 
    #194#160,           // #160
2694
 
    '',                 // #161
2695
 
    #194#162,           // #162
2696
 
    #194#163,           // #163
2697
 
    #194#164,           // #164
2698
 
    '',                 // #165
2699
 
    #194#166,           // #166
2700
 
    #194#167,           // #167
2701
 
    #195#152,           // #168
2702
 
    #194#169,           // #169
2703
 
    #197#150,           // #170
2704
 
    #194#171,           // #171
2705
 
    #194#172,           // #172
2706
 
    #194#173,           // #173
2707
 
    #194#174,           // #174
2708
 
    #195#134,           // #175
2709
 
    #194#176,           // #176
2710
 
    #194#177,           // #177
2711
 
    #194#178,           // #178
2712
 
    #194#179,           // #179
2713
 
    #194#180,           // #180
2714
 
    #194#181,           // #181
2715
 
    #194#182,           // #182
2716
 
    #194#183,           // #183
2717
 
    #195#184,           // #184
2718
 
    #194#185,           // #185
2719
 
    #197#151,           // #186
2720
 
    #194#187,           // #187
2721
 
    #194#188,           // #188
2722
 
    #194#189,           // #189
2723
 
    #194#190,           // #190
2724
 
    #195#166,           // #191
2725
 
    #196#132,           // #192
2726
 
    #196#174,           // #193
2727
 
    #196#128,           // #194
2728
 
    #196#134,           // #195
2729
 
    #195#132,           // #196
2730
 
    #195#133,           // #197
2731
 
    #196#152,           // #198
2732
 
    #196#146,           // #199
2733
 
    #196#140,           // #200
2734
 
    #195#137,           // #201
2735
 
    #197#185,           // #202
2736
 
    #196#150,           // #203
2737
 
    #196#162,           // #204
2738
 
    #196#182,           // #205
2739
 
    #196#170,           // #206
2740
 
    #196#187,           // #207
2741
 
    #197#160,           // #208
2742
 
    #197#131,           // #209
2743
 
    #197#133,           // #210
2744
 
    #195#147,           // #211
2745
 
    #197#140,           // #212
2746
 
    #195#149,           // #213
2747
 
    #195#150,           // #214
2748
 
    #195#151,           // #215
2749
 
    #197#178,           // #216
2750
 
    #197#129,           // #217
2751
 
    #197#154,           // #218
2752
 
    #197#170,           // #219
2753
 
    #195#156,           // #220
2754
 
    #197#187,           // #221
2755
 
    #197#189,           // #222
2756
 
    #195#159,           // #223
2757
 
    #196#133,           // #224
2758
 
    #196#175,           // #225
2759
 
    #196#129,           // #226
2760
 
    #196#135,           // #227
2761
 
    #195#164,           // #228
2762
 
    #195#165,           // #229
2763
 
    #196#153,           // #230
2764
 
    #196#147,           // #231
2765
 
    #196#141,           // #232
2766
 
    #195#169,           // #233
2767
 
    #197#186,           // #234
2768
 
    #196#151,           // #235
2769
 
    #196#163,           // #236
2770
 
    #196#183,           // #237
2771
 
    #196#171,           // #238
2772
 
    #196#188,           // #239
2773
 
    #197#161,           // #240
2774
 
    #197#132,           // #241
2775
 
    #197#134,           // #242
2776
 
    #195#179,           // #243
2777
 
    #197#141,           // #244
2778
 
    #195#181,           // #245
2779
 
    #195#182,           // #246
2780
 
    #195#183,           // #247
2781
 
    #197#179,           // #248
2782
 
    #197#130,           // #249
2783
 
    #197#155,           // #250
2784
 
    #197#171,           // #251
2785
 
    #195#188,           // #252
2786
 
    #197#188,           // #253
2787
 
    #197#190,           // #254
2788
 
    #203#153            // #255
2789
 
  );
2790
 
 
2791
 
  ArrayCP1258ToUTF8: TCharToUTF8Table = (
2792
 
    #0,                 // #0
2793
 
    #1,                 // #1
2794
 
    #2,                 // #2
2795
 
    #3,                 // #3
2796
 
    #4,                 // #4
2797
 
    #5,                 // #5
2798
 
    #6,                 // #6
2799
 
    #7,                 // #7
2800
 
    #8,                 // #8
2801
 
    #9,                 // #9
2802
 
    #10,                // #10
2803
 
    #11,                // #11
2804
 
    #12,                // #12
2805
 
    #13,                // #13
2806
 
    #14,                // #14
2807
 
    #15,                // #15
2808
 
    #16,                // #16
2809
 
    #17,                // #17
2810
 
    #18,                // #18
2811
 
    #19,                // #19
2812
 
    #20,                // #20
2813
 
    #21,                // #21
2814
 
    #22,                // #22
2815
 
    #23,                // #23
2816
 
    #24,                // #24
2817
 
    #25,                // #25
2818
 
    #26,                // #26
2819
 
    #27,                // #27
2820
 
    #28,                // #28
2821
 
    #29,                // #29
2822
 
    #30,                // #30
2823
 
    #31,                // #31
2824
 
    ' ',                // ' '
2825
 
    '!',                // '!'
2826
 
    '"',                // '"'
2827
 
    '#',                // '#'
2828
 
    '$',                // '$'
2829
 
    '%',                // '%'
2830
 
    '&',                // '&'
2831
 
    '''',               // ''''
2832
 
    '(',                // '('
2833
 
    ')',                // ')'
2834
 
    '*',                // '*'
2835
 
    '+',                // '+'
2836
 
    ',',                // ','
2837
 
    '-',                // '-'
2838
 
    '.',                // '.'
2839
 
    '/',                // '/'
2840
 
    '0',                // '0'
2841
 
    '1',                // '1'
2842
 
    '2',                // '2'
2843
 
    '3',                // '3'
2844
 
    '4',                // '4'
2845
 
    '5',                // '5'
2846
 
    '6',                // '6'
2847
 
    '7',                // '7'
2848
 
    '8',                // '8'
2849
 
    '9',                // '9'
2850
 
    ':',                // ':'
2851
 
    ';',                // ';'
2852
 
    '<',                // '<'
2853
 
    '=',                // '='
2854
 
    '>',                // '>'
2855
 
    '?',                // '?'
2856
 
    '@',                // '@'
2857
 
    'A',                // 'A'
2858
 
    'B',                // 'B'
2859
 
    'C',                // 'C'
2860
 
    'D',                // 'D'
2861
 
    'E',                // 'E'
2862
 
    'F',                // 'F'
2863
 
    'G',                // 'G'
2864
 
    'H',                // 'H'
2865
 
    'I',                // 'I'
2866
 
    'J',                // 'J'
2867
 
    'K',                // 'K'
2868
 
    'L',                // 'L'
2869
 
    'M',                // 'M'
2870
 
    'N',                // 'N'
2871
 
    'O',                // 'O'
2872
 
    'P',                // 'P'
2873
 
    'Q',                // 'Q'
2874
 
    'R',                // 'R'
2875
 
    'S',                // 'S'
2876
 
    'T',                // 'T'
2877
 
    'U',                // 'U'
2878
 
    'V',                // 'V'
2879
 
    'W',                // 'W'
2880
 
    'X',                // 'X'
2881
 
    'Y',                // 'Y'
2882
 
    'Z',                // 'Z'
2883
 
    '[',                // '['
2884
 
    '\',                // '\'
2885
 
    ']',                // ']'
2886
 
    '^',                // '^'
2887
 
    '_',                // '_'
2888
 
    '`',                // '`'
2889
 
    'a',                // 'a'
2890
 
    'b',                // 'b'
2891
 
    'c',                // 'c'
2892
 
    'd',                // 'd'
2893
 
    'e',                // 'e'
2894
 
    'f',                // 'f'
2895
 
    'g',                // 'g'
2896
 
    'h',                // 'h'
2897
 
    'i',                // 'i'
2898
 
    'j',                // 'j'
2899
 
    'k',                // 'k'
2900
 
    'l',                // 'l'
2901
 
    'm',                // 'm'
2902
 
    'n',                // 'n'
2903
 
    'o',                // 'o'
2904
 
    'p',                // 'p'
2905
 
    'q',                // 'q'
2906
 
    'r',                // 'r'
2907
 
    's',                // 's'
2908
 
    't',                // 't'
2909
 
    'u',                // 'u'
2910
 
    'v',                // 'v'
2911
 
    'w',                // 'w'
2912
 
    'x',                // 'x'
2913
 
    'y',                // 'y'
2914
 
    'z',                // 'z'
2915
 
    '{',                // '{'
2916
 
    '|',                // '|'
2917
 
    '}',                // '}'
2918
 
    '~',                // '~'
2919
 
    #127,               // #127
2920
 
    #226#130#172,       // #128
2921
 
    '',                 // #129
2922
 
    #226#128#154,       // #130
2923
 
    #198#146,           // #131
2924
 
    #226#128#158,       // #132
2925
 
    #226#128#166,       // #133
2926
 
    #226#128#160,       // #134
2927
 
    #226#128#161,       // #135
2928
 
    #203#134,           // #136
2929
 
    #226#128#176,       // #137
2930
 
    '',                 // #138
2931
 
    #226#128#185,       // #139
2932
 
    #197#146,           // #140
2933
 
    '',                 // #141
2934
 
    '',                 // #142
2935
 
    '',                 // #143
2936
 
    '',                 // #144
2937
 
    #226#128#152,       // #145
2938
 
    #226#128#153,       // #146
2939
 
    #226#128#156,       // #147
2940
 
    #226#128#157,       // #148
2941
 
    #226#128#162,       // #149
2942
 
    #226#128#147,       // #150
2943
 
    #226#128#148,       // #151
2944
 
    #203#156,           // #152
2945
 
    #226#132#162,       // #153
2946
 
    '',                 // #154
2947
 
    #226#128#186,       // #155
2948
 
    #197#147,           // #156
2949
 
    '',                 // #157
2950
 
    '',                 // #158
2951
 
    #197#184,           // #159
2952
 
    #194#160,           // #160
2953
 
    #194#161,           // #161
2954
 
    #194#162,           // #162
2955
 
    #194#163,           // #163
2956
 
    #194#164,           // #164
2957
 
    #194#165,           // #165
2958
 
    #194#166,           // #166
2959
 
    #194#167,           // #167
2960
 
    #194#168,           // #168
2961
 
    #194#169,           // #169
2962
 
    #194#170,           // #170
2963
 
    #194#171,           // #171
2964
 
    #194#172,           // #172
2965
 
    #194#173,           // #173
2966
 
    #194#174,           // #174
2967
 
    #194#175,           // #175
2968
 
    #194#176,           // #176
2969
 
    #194#177,           // #177
2970
 
    #194#178,           // #178
2971
 
    #194#179,           // #179
2972
 
    #194#180,           // #180
2973
 
    #194#181,           // #181
2974
 
    #194#182,           // #182
2975
 
    #194#183,           // #183
2976
 
    #194#184,           // #184
2977
 
    #194#185,           // #185
2978
 
    #194#186,           // #186
2979
 
    #194#187,           // #187
2980
 
    #194#188,           // #188
2981
 
    #194#189,           // #189
2982
 
    #194#190,           // #190
2983
 
    #194#191,           // #191
2984
 
    #195#128,           // #192
2985
 
    #195#129,           // #193
2986
 
    #195#130,           // #194
2987
 
    #196#130,           // #195
2988
 
    #195#132,           // #196
2989
 
    #195#133,           // #197
2990
 
    #195#134,           // #198
2991
 
    #195#135,           // #199
2992
 
    #195#136,           // #200
2993
 
    #195#137,           // #201
2994
 
    #195#138,           // #202
2995
 
    #195#139,           // #203
2996
 
    #204#128,           // #204
2997
 
    #195#141,           // #205
2998
 
    #195#142,           // #206
2999
 
    #195#143,           // #207
3000
 
    #196#144,           // #208
3001
 
    #195#145,           // #209
3002
 
    #204#137,           // #210
3003
 
    #195#147,           // #211
3004
 
    #195#148,           // #212
3005
 
    #198#160,           // #213
3006
 
    #195#150,           // #214
3007
 
    #195#151,           // #215
3008
 
    #195#152,           // #216
3009
 
    #195#153,           // #217
3010
 
    #195#154,           // #218
3011
 
    #195#155,           // #219
3012
 
    #195#156,           // #220
3013
 
    #198#175,           // #221
3014
 
    #204#131,           // #222
3015
 
    #195#159,           // #223
3016
 
    #195#160,           // #224
3017
 
    #195#161,           // #225
3018
 
    #195#162,           // #226
3019
 
    #196#131,           // #227
3020
 
    #195#164,           // #228
3021
 
    #195#165,           // #229
3022
 
    #195#166,           // #230
3023
 
    #195#167,           // #231
3024
 
    #195#168,           // #232
3025
 
    #195#169,           // #233
3026
 
    #195#170,           // #234
3027
 
    #195#171,           // #235
3028
 
    #204#129,           // #236
3029
 
    #195#173,           // #237
3030
 
    #195#174,           // #238
3031
 
    #195#175,           // #239
3032
 
    #196#145,           // #240
3033
 
    #195#177,           // #241
3034
 
    #204#163,           // #242
3035
 
    #195#179,           // #243
3036
 
    #195#180,           // #244
3037
 
    #198#161,           // #245
3038
 
    #195#182,           // #246
3039
 
    #195#183,           // #247
3040
 
    #195#184,           // #248
3041
 
    #195#185,           // #249
3042
 
    #195#186,           // #250
3043
 
    #195#187,           // #251
3044
 
    #195#188,           // #252
3045
 
    #198#176,           // #253
3046
 
    #226#130#171,       // #254
3047
 
    #195#191            // #255
3048
 
  );
3049
 
  
3050
 
  ArrayCP437ToUTF8 : TCharToUTF8Table = (
3051
 
    #0,                 // #0
3052
 
    #1,                 // #1
3053
 
    #2,                 // #2
3054
 
    #3,                 // #3
3055
 
    #4,                 // #4
3056
 
    #5,                 // #5
3057
 
    #6,                 // #6
3058
 
    #7,                 // #7
3059
 
    #8,                 // #8
3060
 
    #9,                 // #9
3061
 
    #10,                // #10
3062
 
    #11,                // #11
3063
 
    #12,                // #12
3064
 
    #13,                // #13
3065
 
    #14,                // #14
3066
 
    #15,                // #15
3067
 
    #16,                // #16
3068
 
    #17,                // #17
3069
 
    #18,                // #18
3070
 
    #19,                // #19
3071
 
    #20,                // #20
3072
 
    #21,                // #21
3073
 
    #22,                // #22
3074
 
    #23,                // #23
3075
 
    #24,                // #24
3076
 
    #25,                // #25
3077
 
    #26,                // #26
3078
 
    #27,                // #27
3079
 
    #28,                // #28
3080
 
    #29,                // #29
3081
 
    #30,                // #30
3082
 
    #31,                // #31
3083
 
    ' ',                // ' '
3084
 
    '!',                // '!'
3085
 
    '"',                // '"'
3086
 
    '#',                // '#'
3087
 
    '$',                // '$'
3088
 
    '%',                // '%'
3089
 
    '&',                // '&'
3090
 
    '''',               // ''''
3091
 
    '(',                // '('
3092
 
    ')',                // ')'
3093
 
    '*',                // '*'
3094
 
    '+',                // '+'
3095
 
    ',',                // ','
3096
 
    '-',                // '-'
3097
 
    '.',                // '.'
3098
 
    '/',                // '/'
3099
 
    '0',                // '0'
3100
 
    '1',                // '1'
3101
 
    '2',                // '2'
3102
 
    '3',                // '3'
3103
 
    '4',                // '4'
3104
 
    '5',                // '5'
3105
 
    '6',                // '6'
3106
 
    '7',                // '7'
3107
 
    '8',                // '8'
3108
 
    '9',                // '9'
3109
 
    ':',                // ':'
3110
 
    ';',                // ';'
3111
 
    '<',                // '<'
3112
 
    '=',                // '='
3113
 
    '>',                // '>'
3114
 
    '?',                // '?'
3115
 
    '@',                // '@'
3116
 
    'A',                // 'A'
3117
 
    'B',                // 'B'
3118
 
    'C',                // 'C'
3119
 
    'D',                // 'D'
3120
 
    'E',                // 'E'
3121
 
    'F',                // 'F'
3122
 
    'G',                // 'G'
3123
 
    'H',                // 'H'
3124
 
    'I',                // 'I'
3125
 
    'J',                // 'J'
3126
 
    'K',                // 'K'
3127
 
    'L',                // 'L'
3128
 
    'M',                // 'M'
3129
 
    'N',                // 'N'
3130
 
    'O',                // 'O'
3131
 
    'P',                // 'P'
3132
 
    'Q',                // 'Q'
3133
 
    'R',                // 'R'
3134
 
    'S',                // 'S'
3135
 
    'T',                // 'T'
3136
 
    'U',                // 'U'
3137
 
    'V',                // 'V'
3138
 
    'W',                // 'W'
3139
 
    'X',                // 'X'
3140
 
    'Y',                // 'Y'
3141
 
    'Z',                // 'Z'
3142
 
    '[',                // '['
3143
 
    '\',                // '\'
3144
 
    ']',                // ']'
3145
 
    '^',                // '^'
3146
 
    '_',                // '_'
3147
 
    '`',                // '`'
3148
 
    'a',                // 'a'
3149
 
    'b',                // 'b'
3150
 
    'c',                // 'c'
3151
 
    'd',                // 'd'
3152
 
    'e',                // 'e'
3153
 
    'f',                // 'f'
3154
 
    'g',                // 'g'
3155
 
    'h',                // 'h'
3156
 
    'i',                // 'i'
3157
 
    'j',                // 'j'
3158
 
    'k',                // 'k'
3159
 
    'l',                // 'l'
3160
 
    'm',                // 'm'
3161
 
    'n',                // 'n'
3162
 
    'o',                // 'o'
3163
 
    'p',                // 'p'
3164
 
    'q',                // 'q'
3165
 
    'r',                // 'r'
3166
 
    's',                // 's'
3167
 
    't',                // 't'
3168
 
    'u',                // 'u'
3169
 
    'v',                // 'v'
3170
 
    'w',                // 'w'
3171
 
    'x',                // 'x'
3172
 
    'y',                // 'y'
3173
 
    'z',                // 'z'
3174
 
    '{',                // '{'
3175
 
    '|',                // '|'
3176
 
    '}',                // '}'
3177
 
    '~',                // '~'
3178
 
    #127,               // #127
3179
 
    #195#135,           // #128
3180
 
    #195#188,           // #129
3181
 
    #195#169,           // #130
3182
 
    #195#162,           // #131
3183
 
    #195#164,           // #132
3184
 
    #195#160,           // #133
3185
 
    #195#165,           // #134
3186
 
    #195#167,           // #135
3187
 
    #195#170,           // #136
3188
 
    #195#171,           // #137
3189
 
    #195#168,           // #138
3190
 
    #195#175,           // #139
3191
 
    #195#174,           // #140
3192
 
    #195#172,           // #141
3193
 
    #195#132,           // #142
3194
 
    #195#133,           // #143
3195
 
    #195#137,           // #144
3196
 
    #195#166,           // #145
3197
 
    #195#134,           // #146
3198
 
    #195#180,           // #147
3199
 
    #195#182,           // #148
3200
 
    #195#178,           // #149
3201
 
    #195#187,           // #150
3202
 
    #195#185,           // #151
3203
 
    #195#191,           // #152
3204
 
    #195#150,           // #153
3205
 
    #195#156,           // #154
3206
 
    #194#162,           // #155
3207
 
    #194#163,           // #156
3208
 
    #194#165,           // #157
3209
 
    #226#130#167,       // #158
3210
 
    #198#146,           // #159
3211
 
    #195#161,           // #160
3212
 
    #195#173,           // #161
3213
 
    #195#179,           // #162
3214
 
    #195#186,           // #163
3215
 
    #195#177,           // #164
3216
 
    #195#145,           // #165
3217
 
    #194#170,           // #166
3218
 
    #194#186,           // #167
3219
 
    #194#191,           // #168
3220
 
    #226#140#144,       // #169
3221
 
    #194#172,           // #170
3222
 
    #194#189,           // #171
3223
 
    #194#188,           // #172
3224
 
    #194#161,           // #173
3225
 
    #194#171,           // #174
3226
 
    #194#187,           // #175
3227
 
    #226#150#145,       // #176
3228
 
    #226#150#146,       // #177
3229
 
    #226#150#147,       // #178
3230
 
    #226#148#130,       // #179
3231
 
    #226#148#164,       // #180
3232
 
    #226#149#161,       // #181
3233
 
    #226#149#162,       // #182
3234
 
    #226#149#150,       // #183
3235
 
    #226#149#149,       // #184
3236
 
    #226#149#163,       // #185
3237
 
    #226#149#145,       // #186
3238
 
    #226#149#151,       // #187
3239
 
    #226#149#157,       // #188
3240
 
    #226#149#156,       // #189
3241
 
    #226#149#155,       // #190
3242
 
    #226#148#144,       // #191
3243
 
    #226#148#148,       // #192
3244
 
    #226#148#180,       // #193
3245
 
    #226#148#172,       // #194
3246
 
    #226#148#156,       // #195
3247
 
    #226#148#128,       // #196
3248
 
    #226#148#188,       // #197
3249
 
    #226#149#158,       // #198
3250
 
    #226#149#159,       // #199
3251
 
    #226#149#154,       // #200
3252
 
    #226#149#148,       // #201
3253
 
    #226#149#169,       // #202
3254
 
    #226#149#166,       // #203
3255
 
    #226#149#160,       // #204
3256
 
    #226#149#144,       // #205
3257
 
    #226#149#172,       // #206
3258
 
    #226#149#167,       // #207
3259
 
    #226#149#168,       // #208
3260
 
    #226#149#164,       // #209
3261
 
    #226#149#165,       // #210
3262
 
    #226#149#153,       // #211
3263
 
    #226#149#152,       // #212
3264
 
    #226#149#146,       // #213
3265
 
    #226#149#147,       // #214
3266
 
    #226#149#171,       // #215
3267
 
    #226#149#170,       // #216
3268
 
    #226#148#152,       // #217
3269
 
    #226#148#140,       // #218
3270
 
    #226#150#136,       // #219
3271
 
    #226#150#132,       // #220
3272
 
    #226#150#140,       // #221
3273
 
    #226#150#144,       // #222
3274
 
    #226#150#128,       // #223
3275
 
    #206#177,           // #224
3276
 
    #195#159,           // #225
3277
 
    #206#147,           // #226
3278
 
    #207#128,           // #227
3279
 
    #206#163,           // #228
3280
 
    #207#131,           // #229
3281
 
    #194#181,           // #230
3282
 
    #207#132,           // #231
3283
 
    #206#166,           // #232
3284
 
    #206#152,           // #233
3285
 
    #206#169,           // #234
3286
 
    #206#180,           // #235
3287
 
    #226#136#158,       // #236
3288
 
    #207#134,           // #237
3289
 
    #206#181,           // #238
3290
 
    #226#136#169,       // #239
3291
 
    #226#137#161,       // #240
3292
 
    #194#177,           // #241
3293
 
    #226#137#165,       // #242
3294
 
    #226#137#164,       // #243
3295
 
    #226#140#160,       // #244
3296
 
    #226#140#161,       // #245
3297
 
    #195#183,           // #246
3298
 
    #226#137#136,       // #247
3299
 
    #194#176,           // #248
3300
 
    #226#136#153,       // #249
3301
 
    #194#183,           // #250
3302
 
    #226#136#154,       // #251
3303
 
    #226#129#191,       // #252
3304
 
    #194#178,           // #253
3305
 
    #226#150#160,       // #254
3306
 
    #194#160            // #255
3307
 
  );
3308
 
 
3309
 
  ArrayCP850ToUTF8 : TCharToUTF8Table = (
3310
 
    #0,                 // #0
3311
 
    #1,                 // #1
3312
 
    #2,                 // #2
3313
 
    #3,                 // #3
3314
 
    #4,                 // #4
3315
 
    #5,                 // #5
3316
 
    #6,                 // #6
3317
 
    #7,                 // #7
3318
 
    #8,                 // #8
3319
 
    #9,                 // #9
3320
 
    #10,                // #10
3321
 
    #11,                // #11
3322
 
    #12,                // #12
3323
 
    #13,                // #13
3324
 
    #14,                // #14
3325
 
    #15,                // #15
3326
 
    #16,                // #16
3327
 
    #17,                // #17
3328
 
    #18,                // #18
3329
 
    #19,                // #19
3330
 
    #20,                // #20
3331
 
    #21,                // #21
3332
 
    #22,                // #22
3333
 
    #23,                // #23
3334
 
    #24,                // #24
3335
 
    #25,                // #25
3336
 
    #26,                // #26
3337
 
    #27,                // #27
3338
 
    #28,                // #28
3339
 
    #29,                // #29
3340
 
    #30,                // #30
3341
 
    #31,                // #31
3342
 
    ' ',                // ' '
3343
 
    '!',                // '!'
3344
 
    '"',                // '"'
3345
 
    '#',                // '#'
3346
 
    '$',                // '$'
3347
 
    '%',                // '%'
3348
 
    '&',                // '&'
3349
 
    '''',               // ''''
3350
 
    '(',                // '('
3351
 
    ')',                // ')'
3352
 
    '*',                // '*'
3353
 
    '+',                // '+'
3354
 
    ',',                // ','
3355
 
    '-',                // '-'
3356
 
    '.',                // '.'
3357
 
    '/',                // '/'
3358
 
    '0',                // '0'
3359
 
    '1',                // '1'
3360
 
    '2',                // '2'
3361
 
    '3',                // '3'
3362
 
    '4',                // '4'
3363
 
    '5',                // '5'
3364
 
    '6',                // '6'
3365
 
    '7',                // '7'
3366
 
    '8',                // '8'
3367
 
    '9',                // '9'
3368
 
    ':',                // ':'
3369
 
    ';',                // ';'
3370
 
    '<',                // '<'
3371
 
    '=',                // '='
3372
 
    '>',                // '>'
3373
 
    '?',                // '?'
3374
 
    '@',                // '@'
3375
 
    'A',                // 'A'
3376
 
    'B',                // 'B'
3377
 
    'C',                // 'C'
3378
 
    'D',                // 'D'
3379
 
    'E',                // 'E'
3380
 
    'F',                // 'F'
3381
 
    'G',                // 'G'
3382
 
    'H',                // 'H'
3383
 
    'I',                // 'I'
3384
 
    'J',                // 'J'
3385
 
    'K',                // 'K'
3386
 
    'L',                // 'L'
3387
 
    'M',                // 'M'
3388
 
    'N',                // 'N'
3389
 
    'O',                // 'O'
3390
 
    'P',                // 'P'
3391
 
    'Q',                // 'Q'
3392
 
    'R',                // 'R'
3393
 
    'S',                // 'S'
3394
 
    'T',                // 'T'
3395
 
    'U',                // 'U'
3396
 
    'V',                // 'V'
3397
 
    'W',                // 'W'
3398
 
    'X',                // 'X'
3399
 
    'Y',                // 'Y'
3400
 
    'Z',                // 'Z'
3401
 
    '[',                // '['
3402
 
    '\',                // '\'
3403
 
    ']',                // ']'
3404
 
    '^',                // '^'
3405
 
    '_',                // '_'
3406
 
    '`',                // '`'
3407
 
    'a',                // 'a'
3408
 
    'b',                // 'b'
3409
 
    'c',                // 'c'
3410
 
    'd',                // 'd'
3411
 
    'e',                // 'e'
3412
 
    'f',                // 'f'
3413
 
    'g',                // 'g'
3414
 
    'h',                // 'h'
3415
 
    'i',                // 'i'
3416
 
    'j',                // 'j'
3417
 
    'k',                // 'k'
3418
 
    'l',                // 'l'
3419
 
    'm',                // 'm'
3420
 
    'n',                // 'n'
3421
 
    'o',                // 'o'
3422
 
    'p',                // 'p'
3423
 
    'q',                // 'q'
3424
 
    'r',                // 'r'
3425
 
    's',                // 's'
3426
 
    't',                // 't'
3427
 
    'u',                // 'u'
3428
 
    'v',                // 'v'
3429
 
    'w',                // 'w'
3430
 
    'x',                // 'x'
3431
 
    'y',                // 'y'
3432
 
    'z',                // 'z'
3433
 
    '{',                // '{'
3434
 
    '|',                // '|'
3435
 
    '}',                // '}'
3436
 
    '~',                // '~'
3437
 
    #127,               // #127
3438
 
    #195#135,           // #128
3439
 
    #195#188,           // #129
3440
 
    #195#169,           // #130
3441
 
    #195#162,           // #131
3442
 
    #195#164,           // #132
3443
 
    #195#160,           // #133
3444
 
    #195#165,           // #134
3445
 
    #195#167,           // #135
3446
 
    #195#170,           // #136
3447
 
    #195#171,           // #137
3448
 
    #195#168,           // #138
3449
 
    #195#175,           // #139
3450
 
    #195#174,           // #140
3451
 
    #195#172,           // #141
3452
 
    #195#132,           // #142
3453
 
    #195#133,           // #143
3454
 
    #195#137,           // #144
3455
 
    #195#166,           // #145
3456
 
    #195#134,           // #146
3457
 
    #195#180,           // #147
3458
 
    #195#182,           // #148
3459
 
    #195#178,           // #149
3460
 
    #195#187,           // #150
3461
 
    #195#185,           // #151
3462
 
    #195#191,           // #152
3463
 
    #195#150,           // #153
3464
 
    #195#156,           // #154
3465
 
    #195#184,           // #155
3466
 
    #194#163,           // #156
3467
 
    #195#152,           // #157
3468
 
    #195#151,           // #158
3469
 
    #198#146,           // #159
3470
 
    #195#161,           // #160
3471
 
    #195#173,           // #161
3472
 
    #195#179,           // #162
3473
 
    #195#186,           // #163
3474
 
    #195#177,           // #164
3475
 
    #195#145,           // #165
3476
 
    #194#170,           // #166
3477
 
    #194#186,           // #167
3478
 
    #194#191,           // #168
3479
 
    #194#174,           // #169
3480
 
    #194#172,           // #170
3481
 
    #194#189,           // #171
3482
 
    #194#188,           // #172
3483
 
    #194#161,           // #173
3484
 
    #194#171,           // #174
3485
 
    #194#187,           // #175
3486
 
    #226#150#145,       // #176
3487
 
    #226#150#146,       // #177
3488
 
    #226#150#147,       // #178
3489
 
    #226#148#130,       // #179
3490
 
    #226#148#164,       // #180
3491
 
    #195#129,           // #181
3492
 
    #195#130,           // #182
3493
 
    #195#128,           // #183
3494
 
    #194#169,           // #184
3495
 
    #226#149#163,       // #185
3496
 
    #226#149#145,       // #186
3497
 
    #226#149#151,       // #187
3498
 
    #226#149#157,       // #188
3499
 
    #194#162,           // #189
3500
 
    #194#165,           // #190
3501
 
    #226#148#144,       // #191
3502
 
    #226#148#148,       // #192
3503
 
    #226#148#180,       // #193
3504
 
    #226#148#172,       // #194
3505
 
    #226#148#156,       // #195
3506
 
    #226#148#128,       // #196
3507
 
    #226#148#188,       // #197
3508
 
    #195#163,           // #198
3509
 
    #195#131,           // #199
3510
 
    #226#149#154,       // #200
3511
 
    #226#149#148,       // #201
3512
 
    #226#149#169,       // #202
3513
 
    #226#149#166,       // #203
3514
 
    #226#149#160,       // #204
3515
 
    #226#149#144,       // #205
3516
 
    #226#149#172,       // #206
3517
 
    #194#164,           // #207
3518
 
    #195#176,           // #208
3519
 
    #195#144,           // #209
3520
 
    #195#138,           // #210
3521
 
    #195#139,           // #211
3522
 
    #195#136,           // #212
3523
 
    #196#177,           // #213
3524
 
    #195#141,           // #214
3525
 
    #195#142,           // #215
3526
 
    #195#143,           // #216
3527
 
    #226#148#152,       // #217
3528
 
    #226#148#140,       // #218
3529
 
    #226#150#136,       // #219
3530
 
    #226#150#132,       // #220
3531
 
    #194#166,           // #221
3532
 
    #195#140,           // #222
3533
 
    #226#150#128,       // #223
3534
 
    #195#147,           // #224
3535
 
    #195#159,           // #225
3536
 
    #195#148,           // #226
3537
 
    #195#146,           // #227
3538
 
    #195#181,           // #228
3539
 
    #195#149,           // #229
3540
 
    #194#181,           // #230
3541
 
    #195#190,           // #231
3542
 
    #195#158,           // #232
3543
 
    #195#154,           // #233
3544
 
    #195#155,           // #234
3545
 
    #195#153,           // #235
3546
 
    #195#189,           // #236
3547
 
    #195#157,           // #237
3548
 
    #194#175,           // #238
3549
 
    #194#180,           // #239
3550
 
    #194#173,           // #240
3551
 
    #194#177,           // #241
3552
 
    #226#128#151,       // #242
3553
 
    #194#190,           // #243
3554
 
    #194#182,           // #244
3555
 
    #194#167,           // #245
3556
 
    #195#183,           // #246
3557
 
    #194#184,           // #247
3558
 
    #194#176,           // #248
3559
 
    #194#168,           // #249
3560
 
    #194#183,           // #250
3561
 
    #194#185,           // #251
3562
 
    #194#179,           // #252
3563
 
    #194#178,           // #253
3564
 
    #226#150#160,       // #254
3565
 
    #194#160            // #255
3566
 
  );
3567
 
 
3568
 
  ArrayCP866ToUTF8 : TCharToUTF8Table = (
3569
 
    #0,                 //#0
3570
 
    #1,                 //#1
3571
 
    #2,                 //#2
3572
 
    #3,                 //#3
3573
 
    #4,                 //#4
3574
 
    #5,                 //#5
3575
 
    #6,                 //#6
3576
 
    #7,                 //#7
3577
 
    #8,                 //#8
3578
 
    #9,                 //#9
3579
 
    #10,                //#10
3580
 
    #11,                //#11
3581
 
    #12,                //#12
3582
 
    #13,                //#13
3583
 
    #14,                //#14
3584
 
    #15,                //#15
3585
 
    #16,                //#16
3586
 
    #17,                //#17
3587
 
    #18,                //#18
3588
 
    #19,                //#19
3589
 
    #20,                //#20
3590
 
    #21,                //#21
3591
 
    #22,                //#22
3592
 
    #23,                //#23
3593
 
    #24,                //#24
3594
 
    #25,                //#25
3595
 
    #26,                //#26
3596
 
    #27,                //#27
3597
 
    #28,                //#28
3598
 
    #29,                //#29
3599
 
    #30,                //#30
3600
 
    #31,                //#31
3601
 
    #32,                //#32
3602
 
    #33,                //#33
3603
 
    #34,                //#34
3604
 
    #35,                //#35
3605
 
    #36,                //#36
3606
 
    #37,                //#37
3607
 
    #38,                //#38
3608
 
    #39,                //#39
3609
 
    #40,                //#40
3610
 
    #41,                //#41
3611
 
    #42,                //#42
3612
 
    #43,                //#43
3613
 
    #44,                //#44
3614
 
    #45,                //#45
3615
 
    #46,                //#46
3616
 
    #47,                //#47
3617
 
    #48,                //#48
3618
 
    #49,                //#49
3619
 
    #50,                //#50
3620
 
    #51,                //#51
3621
 
    #52,                //#52
3622
 
    #53,                //#53
3623
 
    #54,                //#54
3624
 
    #55,                //#55
3625
 
    #56,                //#56
3626
 
    #57,                //#57
3627
 
    #58,                //#58
3628
 
    #59,                //#59
3629
 
    #60,                //#60
3630
 
    #61,                //#61
3631
 
    #62,                //#62
3632
 
    #63,                //#63
3633
 
    #64,                //#64
3634
 
    #65,                //#65
3635
 
    #66,                //#66
3636
 
    #67,                //#67
3637
 
    #68,                //#68
3638
 
    #69,                //#69
3639
 
    #70,                //#70
3640
 
    #71,                //#71
3641
 
    #72,                //#72
3642
 
    #73,                //#73
3643
 
    #74,                //#74
3644
 
    #75,                //#75
3645
 
    #76,                //#76
3646
 
    #77,                //#77
3647
 
    #78,                //#78
3648
 
    #79,                //#79
3649
 
    #80,                //#80
3650
 
    #81,                //#81
3651
 
    #82,                //#82
3652
 
    #83,                //#83
3653
 
    #84,                //#84
3654
 
    #85,                //#85
3655
 
    #86,                //#86
3656
 
    #87,                //#87
3657
 
    #88,                //#88
3658
 
    #89,                //#89
3659
 
    #90,                //#90
3660
 
    #91,                //#91
3661
 
    #92,                //#92
3662
 
    #93,                //#93
3663
 
    #94,                //#94
3664
 
    #95,                //#95
3665
 
    #96,                //#96
3666
 
    #97,                //#97
3667
 
    #98,                //#98
3668
 
    #99,                //#99
3669
 
    #100,               //#100
3670
 
    #101,               //#101
3671
 
    #102,               //#102
3672
 
    #103,               //#103
3673
 
    #104,               //#104
3674
 
    #105,               //#105
3675
 
    #106,               //#106
3676
 
    #107,               //#107
3677
 
    #108,               //#108
3678
 
    #109,               //#109
3679
 
    #110,               //#110
3680
 
    #111,               //#111
3681
 
    #112,               //#112
3682
 
    #113,               //#113
3683
 
    #114,               //#114
3684
 
    #115,               //#115
3685
 
    #116,               //#116
3686
 
    #117,               //#117
3687
 
    #118,               //#118
3688
 
    #119,               //#119
3689
 
    #120,               //#120
3690
 
    #121,               //#121
3691
 
    #122,               //#122
3692
 
    #123,               //#123
3693
 
    #124,               //#124
3694
 
    #125,               //#125
3695
 
    #126,               //#126
3696
 
    #127,               //#127
3697
 
    #208#144,           //#128
3698
 
    #208#145,           //#129
3699
 
    #208#146,           //#130
3700
 
    #208#147,           //#131
3701
 
    #208#148,           //#132
3702
 
    #208#149,           //#133
3703
 
    #208#150,           //#134
3704
 
    #208#151,           //#135
3705
 
    #208#152,           //#136
3706
 
    #208#153,           //#137
3707
 
    #208#154,           //#138
3708
 
    #208#155,           //#139
3709
 
    #208#156,           //#140
3710
 
    #208#157,           //#141
3711
 
    #208#158,           //#142
3712
 
    #208#159,           //#143
3713
 
    #208#160,           //#144
3714
 
    #208#161,           //#145
3715
 
    #208#162,           //#146
3716
 
    #208#163,           //#147
3717
 
    #208#164,           //#148
3718
 
    #208#165,           //#149
3719
 
    #208#166,           //#150
3720
 
    #208#167,           //#151
3721
 
    #208#168,           //#152
3722
 
    #208#169,           //#153
3723
 
    #208#170,           //#154
3724
 
    #208#171,           //#155
3725
 
    #208#172,           //#156
3726
 
    #208#173,           //#157
3727
 
    #208#174,           //#158
3728
 
    #208#175,           //#159
3729
 
    #208#176,           //#160
3730
 
    #208#177,           //#161
3731
 
    #208#178,           //#162
3732
 
    #208#179,           //#163
3733
 
    #208#180,           //#164
3734
 
    #208#181,           //#165
3735
 
    #208#182,           //#166
3736
 
    #208#183,           //#167
3737
 
    #208#184,           //#168
3738
 
    #208#185,           //#169
3739
 
    #208#186,           //#170
3740
 
    #208#187,           //#171
3741
 
    #208#188,           //#172
3742
 
    #208#189,           //#173
3743
 
    #208#190,           //#174
3744
 
    #208#191,           //#175
3745
 
    #226#150#145,       //#176
3746
 
    #226#150#146,       //#177
3747
 
    #226#150#147,       //#178
3748
 
    #226#148#130,       //#179
3749
 
    #226#148#164,       //#180
3750
 
    #226#149#161,       //#181
3751
 
    #226#149#162,       //#182
3752
 
    #226#149#150,       //#183
3753
 
    #226#149#149,       //#184
3754
 
    #226#149#163,       //#185
3755
 
    #226#149#145,       //#186
3756
 
    #226#149#151,       //#187
3757
 
    #226#149#157,       //#188
3758
 
    #226#149#156,       //#189
3759
 
    #226#149#155,       //#190
3760
 
    #226#148#144,       //#191
3761
 
    #226#148#148,       //#192
3762
 
    #226#148#180,       //#193
3763
 
    #226#148#172,       //#194
3764
 
    #226#148#156,       //#195
3765
 
    #226#148#128,       //#196
3766
 
    #226#148#188,       //#197
3767
 
    #226#149#158,       //#198
3768
 
    #226#149#159,       //#199
3769
 
    #226#149#154,       //#200
3770
 
    #226#149#148,       //#201
3771
 
    #226#149#169,       //#202
3772
 
    #226#149#166,       //#203
3773
 
    #226#149#160,       //#204
3774
 
    #226#149#144,       //#205
3775
 
    #226#149#172,       //#206
3776
 
    #226#149#167,       //#207
3777
 
    #226#149#168,       //#208
3778
 
    #226#149#164,       //#209
3779
 
    #226#149#165,       //#210
3780
 
    #226#149#153,       //#211
3781
 
    #226#149#152,       //#212
3782
 
    #226#149#146,       //#213
3783
 
    #226#149#147,       //#214
3784
 
    #226#149#171,       //#215
3785
 
    #226#149#170,       //#216
3786
 
    #226#148#152,       //#217
3787
 
    #226#148#140,       //#218
3788
 
    #226#150#136,       //#219
3789
 
    #226#150#132,       //#220
3790
 
    #226#150#140,       //#221
3791
 
    #226#150#144,       //#222
3792
 
    #226#150#128,       //#223
3793
 
    #209#128,           //#224
3794
 
    #209#129,           //#225
3795
 
    #209#130,           //#226
3796
 
    #209#131,           //#227
3797
 
    #209#132,           //#228
3798
 
    #209#133,           //#229
3799
 
    #209#134,           //#230
3800
 
    #209#135,           //#231
3801
 
    #209#136,           //#232
3802
 
    #209#137,           //#233
3803
 
    #209#138,           //#234
3804
 
    #209#139,           //#235
3805
 
    #209#140,           //#236
3806
 
    #209#141,           //#237
3807
 
    #209#142,           //#238
3808
 
    #209#143,           //#239
3809
 
    #208#129,           //#240
3810
 
    #209#145,           //#241
3811
 
    #208#132,           //#242
3812
 
    #209#148,           //#243
3813
 
    #208#135,           //#244
3814
 
    #209#151,           //#245
3815
 
    #208#142,           //#246
3816
 
    #209#158,           //#247
3817
 
    #194#176,           //#248
3818
 
    #226#136#153,       //#249
3819
 
    #194#183,           //#250
3820
 
    #226#136#154,       //#251
3821
 
    #226#132#150,       //#252
3822
 
    #194#164,           //#253
3823
 
    #226#150#160,       //#254
3824
 
    #194#160            //#255
3825
 
  );
3826
 
 
3827
 
  ArrayCP874ToUTF8: TCharToUTF8Table = (
3828
 
    #0,                 // #0
3829
 
    #1,                 // #1
3830
 
    #2,                 // #2
3831
 
    #3,                 // #3
3832
 
    #4,                 // #4
3833
 
    #5,                 // #5
3834
 
    #6,                 // #6
3835
 
    #7,                 // #7
3836
 
    #8,                 // #8
3837
 
    #9,                 // #9
3838
 
    #10,                // #10
3839
 
    #11,                // #11
3840
 
    #12,                // #12
3841
 
    #13,                // #13
3842
 
    #14,                // #14
3843
 
    #15,                // #15
3844
 
    #16,                // #16
3845
 
    #17,                // #17
3846
 
    #18,                // #18
3847
 
    #19,                // #19
3848
 
    #20,                // #20
3849
 
    #21,                // #21
3850
 
    #22,                // #22
3851
 
    #23,                // #23
3852
 
    #24,                // #24
3853
 
    #25,                // #25
3854
 
    #26,                // #26
3855
 
    #27,                // #27
3856
 
    #28,                // #28
3857
 
    #29,                // #29
3858
 
    #30,                // #30
3859
 
    #31,                // #31
3860
 
    ' ',                // ' '
3861
 
    '!',                // '!'
3862
 
    '"',                // '"'
3863
 
    '#',                // '#'
3864
 
    '$',                // '$'
3865
 
    '%',                // '%'
3866
 
    '&',                // '&'
3867
 
    '''',               // ''''
3868
 
    '(',                // '('
3869
 
    ')',                // ')'
3870
 
    '*',                // '*'
3871
 
    '+',                // '+'
3872
 
    ',',                // ','
3873
 
    '-',                // '-'
3874
 
    '.',                // '.'
3875
 
    '/',                // '/'
3876
 
    '0',                // '0'
3877
 
    '1',                // '1'
3878
 
    '2',                // '2'
3879
 
    '3',                // '3'
3880
 
    '4',                // '4'
3881
 
    '5',                // '5'
3882
 
    '6',                // '6'
3883
 
    '7',                // '7'
3884
 
    '8',                // '8'
3885
 
    '9',                // '9'
3886
 
    ':',                // ':'
3887
 
    ';',                // ';'
3888
 
    '<',                // '<'
3889
 
    '=',                // '='
3890
 
    '>',                // '>'
3891
 
    '?',                // '?'
3892
 
    '@',                // '@'
3893
 
    'A',                // 'A'
3894
 
    'B',                // 'B'
3895
 
    'C',                // 'C'
3896
 
    'D',                // 'D'
3897
 
    'E',                // 'E'
3898
 
    'F',                // 'F'
3899
 
    'G',                // 'G'
3900
 
    'H',                // 'H'
3901
 
    'I',                // 'I'
3902
 
    'J',                // 'J'
3903
 
    'K',                // 'K'
3904
 
    'L',                // 'L'
3905
 
    'M',                // 'M'
3906
 
    'N',                // 'N'
3907
 
    'O',                // 'O'
3908
 
    'P',                // 'P'
3909
 
    'Q',                // 'Q'
3910
 
    'R',                // 'R'
3911
 
    'S',                // 'S'
3912
 
    'T',                // 'T'
3913
 
    'U',                // 'U'
3914
 
    'V',                // 'V'
3915
 
    'W',                // 'W'
3916
 
    'X',                // 'X'
3917
 
    'Y',                // 'Y'
3918
 
    'Z',                // 'Z'
3919
 
    '[',                // '['
3920
 
    '\',                // '\'
3921
 
    ']',                // ']'
3922
 
    '^',                // '^'
3923
 
    '_',                // '_'
3924
 
    '`',                // '`'
3925
 
    'a',                // 'a'
3926
 
    'b',                // 'b'
3927
 
    'c',                // 'c'
3928
 
    'd',                // 'd'
3929
 
    'e',                // 'e'
3930
 
    'f',                // 'f'
3931
 
    'g',                // 'g'
3932
 
    'h',                // 'h'
3933
 
    'i',                // 'i'
3934
 
    'j',                // 'j'
3935
 
    'k',                // 'k'
3936
 
    'l',                // 'l'
3937
 
    'm',                // 'm'
3938
 
    'n',                // 'n'
3939
 
    'o',                // 'o'
3940
 
    'p',                // 'p'
3941
 
    'q',                // 'q'
3942
 
    'r',                // 'r'
3943
 
    's',                // 's'
3944
 
    't',                // 't'
3945
 
    'u',                // 'u'
3946
 
    'v',                // 'v'
3947
 
    'w',                // 'w'
3948
 
    'x',                // 'x'
3949
 
    'y',                // 'y'
3950
 
    'z',                // 'z'
3951
 
    '{',                // '{'
3952
 
    '|',                // '|'
3953
 
    '}',                // '}'
3954
 
    '~',                // '~'
3955
 
    #127,               // #127
3956
 
    #226#130#172,       // #128
3957
 
    '',                 // #129
3958
 
    '',                 // #130
3959
 
    '',                 // #131
3960
 
    '',                 // #132
3961
 
    #226#128#166,       // #133
3962
 
    '',                 // #134
3963
 
    '',                 // #135
3964
 
    '',                 // #136
3965
 
    '',                 // #137
3966
 
    '',                 // #138
3967
 
    '',                 // #139
3968
 
    '',                 // #140
3969
 
    '',                 // #141
3970
 
    '',                 // #142
3971
 
    '',                 // #143
3972
 
    '',                 // #144
3973
 
    #226#128#152,       // #145
3974
 
    #226#128#153,       // #146
3975
 
    #226#128#156,       // #147
3976
 
    #226#128#157,       // #148
3977
 
    #226#128#162,       // #149
3978
 
    #226#128#147,       // #150
3979
 
    #226#128#148,       // #151
3980
 
    '',                 // #152
3981
 
    '',                 // #153
3982
 
    '',                 // #154
3983
 
    '',                 // #155
3984
 
    '',                 // #156
3985
 
    '',                 // #157
3986
 
    '',                 // #158
3987
 
    '',                 // #159
3988
 
    #194#160,           // #160
3989
 
    #224#184#129,       // #161
3990
 
    #224#184#130,       // #162
3991
 
    #224#184#131,       // #163
3992
 
    #224#184#132,       // #164
3993
 
    #224#184#133,       // #165
3994
 
    #224#184#134,       // #166
3995
 
    #224#184#135,       // #167
3996
 
    #224#184#136,       // #168
3997
 
    #224#184#137,       // #169
3998
 
    #224#184#138,       // #170
3999
 
    #224#184#139,       // #171
4000
 
    #224#184#140,       // #172
4001
 
    #224#184#141,       // #173
4002
 
    #224#184#142,       // #174
4003
 
    #224#184#143,       // #175
4004
 
    #224#184#144,       // #176
4005
 
    #224#184#145,       // #177
4006
 
    #224#184#146,       // #178
4007
 
    #224#184#147,       // #179
4008
 
    #224#184#148,       // #180
4009
 
    #224#184#149,       // #181
4010
 
    #224#184#150,       // #182
4011
 
    #224#184#151,       // #183
4012
 
    #224#184#152,       // #184
4013
 
    #224#184#153,       // #185
4014
 
    #224#184#154,       // #186
4015
 
    #224#184#155,       // #187
4016
 
    #224#184#156,       // #188
4017
 
    #224#184#157,       // #189
4018
 
    #224#184#158,       // #190
4019
 
    #224#184#159,       // #191
4020
 
    #224#184#160,       // #192
4021
 
    #224#184#161,       // #193
4022
 
    #224#184#162,       // #194
4023
 
    #224#184#163,       // #195
4024
 
    #224#184#164,       // #196
4025
 
    #224#184#165,       // #197
4026
 
    #224#184#166,       // #198
4027
 
    #224#184#167,       // #199
4028
 
    #224#184#168,       // #200
4029
 
    #224#184#169,       // #201
4030
 
    #224#184#170,       // #202
4031
 
    #224#184#171,       // #203
4032
 
    #224#184#172,       // #204
4033
 
    #224#184#173,       // #205
4034
 
    #224#184#174,       // #206
4035
 
    #224#184#175,       // #207
4036
 
    #224#184#176,       // #208
4037
 
    #224#184#177,       // #209
4038
 
    #224#184#178,       // #210
4039
 
    #224#184#179,       // #211
4040
 
    #224#184#180,       // #212
4041
 
    #224#184#181,       // #213
4042
 
    #224#184#182,       // #214
4043
 
    #224#184#183,       // #215
4044
 
    #224#184#184,       // #216
4045
 
    #224#184#185,       // #217
4046
 
    #224#184#186,       // #218
4047
 
    '',                 // #219
4048
 
    '',                 // #220
4049
 
    '',                 // #221
4050
 
    '',                 // #222
4051
 
    #224#184#191,       // #223
4052
 
    #224#185#128,       // #224
4053
 
    #224#185#129,       // #225
4054
 
    #224#185#130,       // #226
4055
 
    #224#185#131,       // #227
4056
 
    #224#185#132,       // #228
4057
 
    #224#185#133,       // #229
4058
 
    #224#185#134,       // #230
4059
 
    #224#185#135,       // #231
4060
 
    #224#185#136,       // #232
4061
 
    #224#185#137,       // #233
4062
 
    #224#185#138,       // #234
4063
 
    #224#185#139,       // #235
4064
 
    #224#185#140,       // #236
4065
 
    #224#185#141,       // #237
4066
 
    #224#185#142,       // #238
4067
 
    #224#185#143,       // #239
4068
 
    #224#185#144,       // #240
4069
 
    #224#185#145,       // #241
4070
 
    #224#185#146,       // #242
4071
 
    #224#185#147,       // #243
4072
 
    #224#185#148,       // #244
4073
 
    #224#185#149,       // #245
4074
 
    #224#185#150,       // #246
4075
 
    #224#185#151,       // #247
4076
 
    #224#185#152,       // #248
4077
 
    #224#185#153,       // #249
4078
 
    #224#185#154,       // #250
4079
 
    #224#185#155,       // #251
4080
 
    '',                 // #252
4081
 
    '',                 // #253
4082
 
    '',                 // #254
4083
 
    ''                  // #255
4084
 
  );
4085
 
 
4086
 
  ArrayKOI8ToUTF8: TCharToUTF8Table = (
4087
 
    #0,                 // #0
4088
 
    #1,                 // #1
4089
 
    #2,                 // #2
4090
 
    #3,                 // #3
4091
 
    #4,                 // #4
4092
 
    #5,                 // #5
4093
 
    #6,                 // #6
4094
 
    #7,                 // #7
4095
 
    #8,                 // #8
4096
 
    #9,                 // #9
4097
 
    #10,                // #10
4098
 
    #11,                // #11
4099
 
    #12,                // #12
4100
 
    #13,                // #13
4101
 
    #14,                // #14
4102
 
    #15,                // #15
4103
 
    #16,                // #16
4104
 
    #17,                // #17
4105
 
    #18,                // #18
4106
 
    #19,                // #19
4107
 
    #20,                // #20
4108
 
    #21,                // #21
4109
 
    #22,                // #22
4110
 
    #23,                // #23
4111
 
    #24,                // #24
4112
 
    #25,                // #25
4113
 
    #26,                // #26
4114
 
    #27,                // #27
4115
 
    #28,                // #28
4116
 
    #29,                // #29
4117
 
    #30,                // #30
4118
 
    #31,                // #31
4119
 
    ' ',                // ' '
4120
 
    '!',                // '!'
4121
 
    '"',                // '"'
4122
 
    '#',                // '#'
4123
 
    '$',                // '$'
4124
 
    '%',                // '%'
4125
 
    '&',                // '&'
4126
 
    '''',               // ''''
4127
 
    '(',                // '('
4128
 
    ')',                // ')'
4129
 
    '*',                // '*'
4130
 
    '+',                // '+'
4131
 
    ',',                // ','
4132
 
    '-',                // '-'
4133
 
    '.',                // '.'
4134
 
    '/',                // '/'
4135
 
    '0',                // '0'
4136
 
    '1',                // '1'
4137
 
    '2',                // '2'
4138
 
    '3',                // '3'
4139
 
    '4',                // '4'
4140
 
    '5',                // '5'
4141
 
    '6',                // '6'
4142
 
    '7',                // '7'
4143
 
    '8',                // '8'
4144
 
    '9',                // '9'
4145
 
    ':',                // ':'
4146
 
    ';',                // ';'
4147
 
    '<',                // '<'
4148
 
    '=',                // '='
4149
 
    '>',                // '>'
4150
 
    '?',                // '?'
4151
 
    '@',                // '@'
4152
 
    'A',                // 'A'
4153
 
    'B',                // 'B'
4154
 
    'C',                // 'C'
4155
 
    'D',                // 'D'
4156
 
    'E',                // 'E'
4157
 
    'F',                // 'F'
4158
 
    'G',                // 'G'
4159
 
    'H',                // 'H'
4160
 
    'I',                // 'I'
4161
 
    'J',                // 'J'
4162
 
    'K',                // 'K'
4163
 
    'L',                // 'L'
4164
 
    'M',                // 'M'
4165
 
    'N',                // 'N'
4166
 
    'O',                // 'O'
4167
 
    'P',                // 'P'
4168
 
    'Q',                // 'Q'
4169
 
    'R',                // 'R'
4170
 
    'S',                // 'S'
4171
 
    'T',                // 'T'
4172
 
    'U',                // 'U'
4173
 
    'V',                // 'V'
4174
 
    'W',                // 'W'
4175
 
    'X',                // 'X'
4176
 
    'Y',                // 'Y'
4177
 
    'Z',                // 'Z'
4178
 
    '[',                // '['
4179
 
    '\',                // '\'
4180
 
    ']',                // ']'
4181
 
    '^',                // '^'
4182
 
    '_',                // '_'
4183
 
    '`',                // '`'
4184
 
    'a',                // 'a'
4185
 
    'b',                // 'b'
4186
 
    'c',                // 'c'
4187
 
    'd',                // 'd'
4188
 
    'e',                // 'e'
4189
 
    'f',                // 'f'
4190
 
    'g',                // 'g'
4191
 
    'h',                // 'h'
4192
 
    'i',                // 'i'
4193
 
    'j',                // 'j'
4194
 
    'k',                // 'k'
4195
 
    'l',                // 'l'
4196
 
    'm',                // 'm'
4197
 
    'n',                // 'n'
4198
 
    'o',                // 'o'
4199
 
    'p',                // 'p'
4200
 
    'q',                // 'q'
4201
 
    'r',                // 'r'
4202
 
    's',                // 's'
4203
 
    't',                // 't'
4204
 
    'u',                // 'u'
4205
 
    'v',                // 'v'
4206
 
    'w',                // 'w'
4207
 
    'x',                // 'x'
4208
 
    'y',                // 'y'
4209
 
    'z',                // 'z'
4210
 
    '{',                // '{'
4211
 
    '|',                // '|'
4212
 
    '}',                // '}'
4213
 
    '~',                // '~'
4214
 
    #127,               // #127
4215
 
    '',                 // #128
4216
 
    '',                 // #129
4217
 
    '',                 // #130
4218
 
    '',                 // #131
4219
 
    '',                 // #132
4220
 
    '',                 // #133
4221
 
    '',                 // #134
4222
 
    '',                 // #135
4223
 
    '',                 // #136
4224
 
    '',                 // #137
4225
 
    '',                 // #138
4226
 
    '',                 // #139
4227
 
    '',                 // #140
4228
 
    '',                 // #141
4229
 
    '',                 // #142
4230
 
    '',                 // #143
4231
 
    '',                 // #144
4232
 
    '',                 // #145
4233
 
    '',                 // #146
4234
 
    '',                 // #147
4235
 
    '',                 // #148
4236
 
    '',                 // #149
4237
 
    '',                 // #150
4238
 
    '',                 // #151
4239
 
    '',                 // #152
4240
 
    '',                 // #153
4241
 
    '',                 // #154
4242
 
    '',                 // #155
4243
 
    '',                 // #156
4244
 
    '',                 // #157
4245
 
    '',                 // #158
4246
 
    '',                 // #159
4247
 
    '',                 // #160
4248
 
    '',                 // #161
4249
 
    '',                 // #162
4250
 
    '',                 // #163
4251
 
    '',                 // #164
4252
 
    '',                 // #165
4253
 
    '',                 // #166
4254
 
    '',                 // #167
4255
 
    '',                 // #168
4256
 
    '',                 // #169
4257
 
    '',                 // #170
4258
 
    '',                 // #171
4259
 
    '',                 // #172
4260
 
    '',                 // #173
4261
 
    '',                 // #174
4262
 
    '',                 // #175
4263
 
    '',                 // #176
4264
 
    '',                 // #177
4265
 
    '',                 // #178
4266
 
    '',                 // #179
4267
 
    '',                 // #180
4268
 
    '',                 // #181
4269
 
    '',                 // #182
4270
 
    '',                 // #183
4271
 
    '',                 // #184
4272
 
    '',                 // #185
4273
 
    '',                 // #186
4274
 
    '',                 // #187
4275
 
    '',                 // #188
4276
 
    '',                 // #189
4277
 
    '',                 // #190
4278
 
    '',                 // #191
4279
 
    #209#142,           // #192
4280
 
    #208#176,           // #193
4281
 
    #208#177,           // #194
4282
 
    #209#134,           // #195
4283
 
    #208#180,           // #196
4284
 
    #208#181,           // #197
4285
 
    #209#132,           // #198
4286
 
    #208#179,           // #199
4287
 
    #209#133,           // #200
4288
 
    #208#184,           // #201
4289
 
    #208#185,           // #202
4290
 
    #208#186,           // #203
4291
 
    #208#187,           // #204
4292
 
    #208#188,           // #205
4293
 
    #208#189,           // #206
4294
 
    #208#190,           // #207
4295
 
    #208#191,           // #208
4296
 
    #209#143,           // #209
4297
 
    #209#128,           // #210
4298
 
    #209#129,           // #211
4299
 
    #209#130,           // #212
4300
 
    #209#131,           // #213
4301
 
    #208#182,           // #214
4302
 
    #208#178,           // #215
4303
 
    #209#140,           // #216
4304
 
    #209#139,           // #217
4305
 
    #208#183,           // #218
4306
 
    #209#136,           // #219
4307
 
    #209#141,           // #220
4308
 
    #209#137,           // #221
4309
 
    #209#135,           // #222
4310
 
    #209#138,           // #223
4311
 
    #208#174,           // #224
4312
 
    #208#144,           // #225
4313
 
    #208#145,           // #226
4314
 
    #208#166,           // #227
4315
 
    #208#148,           // #228
4316
 
    #208#149,           // #229
4317
 
    #208#164,           // #230
4318
 
    #208#147,           // #231
4319
 
    #208#165,           // #232
4320
 
    #208#152,           // #233
4321
 
    #208#153,           // #234
4322
 
    #208#154,           // #235
4323
 
    #208#155,           // #236
4324
 
    #208#156,           // #237
4325
 
    #208#157,           // #238
4326
 
    #208#158,           // #239
4327
 
    #208#159,           // #240
4328
 
    #208#175,           // #241
4329
 
    #208#160,           // #242
4330
 
    #208#161,           // #243
4331
 
    #208#162,           // #244
4332
 
    #208#163,           // #245
4333
 
    #208#150,           // #246
4334
 
    #208#146,           // #247
4335
 
    #208#172,           // #248
4336
 
    #208#171,           // #249
4337
 
    #208#151,           // #250
4338
 
    #208#168,           // #251
4339
 
    #208#173,           // #252
4340
 
    #208#169,           // #253
4341
 
    #208#167,           // #254
4342
 
    ''                  // #255
4343
 
  );
4344
 
 
4345
 
function UTF8BOMToUTF8(const s: string): string;
4346
 
begin
4347
 
  Result:=copy(s,4,length(s));
4348
 
end;
4349
 
 
4350
 
function ISO_8859_1ToUTF8(const s: string): string;
4351
 
begin
4352
 
  Result:=SingleByteToUTF8(s,ArrayISO_8859_1ToUTF8);
4353
 
end;
4354
 
 
4355
 
function ISO_8859_2ToUTF8(const s: string): string;
4356
 
begin
4357
 
  Result:=SingleByteToUTF8(s,ArrayISO_8859_2ToUTF8);
4358
 
end;
4359
 
 
4360
 
function CP1250ToUTF8(const s: string): string;
4361
 
begin
4362
 
  Result:=SingleByteToUTF8(s,ArrayCP1250ToUTF8);
4363
 
end;
4364
 
 
4365
 
function CP1251ToUTF8(const s: string): string;
4366
 
begin
4367
 
  Result:=SingleByteToUTF8(s,ArrayCP1251ToUTF8);
4368
 
end;
4369
 
 
4370
 
function CP1252ToUTF8(const s: string): string;
4371
 
begin
4372
 
  Result:=SingleByteToUTF8(s,ArrayCP1252ToUTF8);
4373
 
end;
4374
 
 
4375
 
function CP1253ToUTF8(const s: string): string;
4376
 
begin
4377
 
  Result:=SingleByteToUTF8(s,ArrayCP1253ToUTF8);
4378
 
end;
4379
 
 
4380
 
function CP1254ToUTF8(const s: string): string;
4381
 
begin
4382
 
  Result:=SingleByteToUTF8(s,ArrayCP1254ToUTF8);
4383
 
end;
4384
 
 
4385
 
function CP1255ToUTF8(const s: string): string;
4386
 
begin
4387
 
  Result:=SingleByteToUTF8(s,ArrayCP1255ToUTF8);
4388
 
end;
4389
 
 
4390
 
function CP1256ToUTF8(const s: string): string;
4391
 
begin
4392
 
  Result:=SingleByteToUTF8(s,ArrayCP1256ToUTF8);
4393
 
end;
4394
 
 
4395
 
function CP1257ToUTF8(const s: string): string;
4396
 
begin
4397
 
  Result:=SingleByteToUTF8(s,ArrayCP1257ToUTF8);
4398
 
end;
4399
 
 
4400
 
function CP1258ToUTF8(const s: string): string;
4401
 
begin
4402
 
  Result:=SingleByteToUTF8(s,ArrayCP1258ToUTF8);
4403
 
end;
4404
 
 
4405
 
function CP437ToUTF8(const s: string): string;
4406
 
begin
4407
 
  Result:=SingleByteToUTF8(s,ArrayCP437ToUTF8);
4408
 
end;
4409
 
 
4410
 
function CP850ToUTF8(const s: string): string;
4411
 
begin
4412
 
  Result:=SingleByteToUTF8(s,ArrayCP850ToUTF8);
4413
 
end;
4414
 
 
4415
 
function CP866ToUTF8(const s: string): string;
4416
 
begin
4417
 
  Result:=SingleByteToUTF8(s,ArrayCP866ToUTF8);
4418
 
end;
4419
 
 
4420
 
function CP874ToUTF8(const s: string): string;
4421
 
begin
4422
 
  Result:=SingleByteToUTF8(s,ArrayCP874ToUTF8);
4423
 
end;
4424
 
 
4425
 
function KOI8ToUTF8(const s: string): string;
4426
 
begin
4427
 
  Result:=SingleByteToUTF8(s,ArrayKOI8ToUTF8);
4428
 
end;
4429
 
 
4430
 
function SingleByteToUTF8(const s: string; const Table: TCharToUTF8Table
4431
 
  ): string;
4432
 
var
4433
 
  len: Integer;
4434
 
  i: Integer;
4435
 
  Src: PChar;
4436
 
  Dest: PChar;
4437
 
  p: PChar;
4438
 
  c: Char;
4439
 
begin
4440
 
  if s='' then begin
4441
 
    Result:=s;
4442
 
    exit;
4443
 
  end;
4444
 
  len:=length(s);
4445
 
  SetLength(Result,len*4);// UTF-8 is at most 4 bytes
4446
 
  Src:=PChar(s);
4447
 
  Dest:=PChar(Result);
4448
 
  for i:=1 to len do begin
4449
 
    c:=Src^;
4450
 
    inc(Src);
4451
 
    if ord(c)<128 then begin
4452
 
      Dest^:=c;
4453
 
      inc(Dest);
4454
 
    end else begin
4455
 
      p:=Table[c];
4456
 
      if p<>nil then begin
4457
 
        while p^<>#0 do begin
4458
 
          Dest^:=p^;
4459
 
          inc(p);
4460
 
          inc(Dest);
4461
 
        end;
4462
 
      end;
4463
 
    end;
4464
 
  end;
4465
 
  SetLength(Result,PtrUInt(Dest)-PtrUInt(Result));
4466
 
end;
4467
 
 
4468
 
function UCS2LEToUTF8(const s: string): string;
4469
 
var
4470
 
  len: Integer;
4471
 
  Src: PWord;
4472
 
  Dest: PChar;
4473
 
  i: Integer;
4474
 
  c: Word;
4475
 
begin
4476
 
  if s='' then begin
4477
 
    Result:=s;
4478
 
    exit;
4479
 
  end;
4480
 
  len:=length(s) div 2;
4481
 
  SetLength(Result,len*3);// UTF-8 is at most three times the size
4482
 
  Src:=PWord(Pointer(s));
4483
 
  Dest:=PChar(Result);
4484
 
  for i:=1 to len do begin
4485
 
    c:=LEtoN(Src^);
4486
 
    inc(Src);
4487
 
    if ord(c)<128 then begin
4488
 
      Dest^:=chr(c);
4489
 
      inc(Dest);
4490
 
    end else begin
4491
 
      inc(Dest,UnicodeToUTF8SkipErrors(c,Dest));
4492
 
    end;
4493
 
  end;
4494
 
  len:=PtrUInt(Dest)-PtrUInt(Result);
4495
 
  if len>length(Result) then
4496
 
    RaiseGDBException('');
4497
 
  SetLength(Result,len);
4498
 
end;
4499
 
 
4500
 
function UCS2BEToUTF8(const s: string): string;
4501
 
var
4502
 
  len: Integer;
4503
 
  Src: PWord;
4504
 
  Dest: PChar;
4505
 
  i: Integer;
4506
 
  c: Word;
4507
 
begin
4508
 
  if s='' then begin
4509
 
    Result:=s;
4510
 
    exit;
4511
 
  end;
4512
 
  len:=length(s) div 2;
4513
 
  SetLength(Result,len*3);// UTF-8 is at most three times the size
4514
 
  Src:=PWord(Pointer(s));
4515
 
  Dest:=PChar(Result);
4516
 
  for i:=1 to len do begin
4517
 
    c:=BEtoN(Src^);
4518
 
    inc(Src);
4519
 
    if ord(c)<128 then begin
4520
 
      Dest^:=chr(c);
4521
 
      inc(Dest);
4522
 
    end else begin
4523
 
      inc(Dest,UnicodeToUTF8SkipErrors(c,Dest));
4524
 
    end;
4525
 
  end;
4526
 
  len:=PtrUInt(Dest)-PtrUInt(Result);
4527
 
  if len>length(Result) then
4528
 
    RaiseGDBException('');
4529
 
  SetLength(Result,len);
4530
 
end;
4531
 
 
4532
 
function UnicodeToCP1250(Unicode: cardinal): integer;
4533
 
begin
4534
 
  case Unicode of
4535
 
  0..127: Result:=Unicode;
4536
 
  160: Result:=160;
4537
 
  164: Result:=164;
4538
 
  166..169: Result:=Unicode;
4539
 
  171..174: Result:=Unicode;
4540
 
  176..177: Result:=Unicode;
4541
 
  180..184: Result:=Unicode;
4542
 
  187: Result:=187;
4543
 
  193..194: Result:=Unicode;
4544
 
  196: Result:=196;
4545
 
  199: Result:=199;
4546
 
  201: Result:=201;
4547
 
  203: Result:=203;
4548
 
  205..206: Result:=Unicode;
4549
 
  211..212: Result:=Unicode;
4550
 
  214..215: Result:=Unicode;
4551
 
  218: Result:=218;
4552
 
  220..221: Result:=Unicode;
4553
 
  223: Result:=223;
4554
 
  225..226: Result:=Unicode;
4555
 
  228: Result:=228;
4556
 
  231: Result:=231;
4557
 
  233: Result:=233;
4558
 
  235: Result:=235;
4559
 
  237..238: Result:=Unicode;
4560
 
  243..244: Result:=Unicode;
4561
 
  246..247: Result:=Unicode;
4562
 
  250: Result:=250;
4563
 
  252..253: Result:=Unicode;
4564
 
  258: Result:=195;
4565
 
  259: Result:=227;
4566
 
  260: Result:=165;
4567
 
  261: Result:=185;
4568
 
  262: Result:=198;
4569
 
  263: Result:=230;
4570
 
  268: Result:=200;
4571
 
  269: Result:=232;
4572
 
  270: Result:=207;
4573
 
  271: Result:=239;
4574
 
  272: Result:=208;
4575
 
  273: Result:=240;
4576
 
  280: Result:=202;
4577
 
  281: Result:=234;
4578
 
  282: Result:=204;
4579
 
  283: Result:=236;
4580
 
  313: Result:=197;
4581
 
  314: Result:=229;
4582
 
  317: Result:=188;
4583
 
  318: Result:=190;
4584
 
  321: Result:=163;
4585
 
  322: Result:=179;
4586
 
  323: Result:=209;
4587
 
  324: Result:=241;
4588
 
  327: Result:=210;
4589
 
  328: Result:=242;
4590
 
  336: Result:=213;
4591
 
  337: Result:=245;
4592
 
  340: Result:=192;
4593
 
  341: Result:=224;
4594
 
  344: Result:=216;
4595
 
  345: Result:=248;
4596
 
  346: Result:=140;
4597
 
  347: Result:=156;
4598
 
  350: Result:=170;
4599
 
  351: Result:=186;
4600
 
  352: Result:=138;
4601
 
  353: Result:=154;
4602
 
  354: Result:=222;
4603
 
  355: Result:=254;
4604
 
  356: Result:=141;
4605
 
  357: Result:=157;
4606
 
  366: Result:=217;
4607
 
  367: Result:=249;
4608
 
  368: Result:=219;
4609
 
  369: Result:=251;
4610
 
  377: Result:=143;
4611
 
  378: Result:=159;
4612
 
  379: Result:=175;
4613
 
  380: Result:=191;
4614
 
  381: Result:=142;
4615
 
  382: Result:=158;
4616
 
  711: Result:=161;
4617
 
  728: Result:=162;
4618
 
  729: Result:=255;
4619
 
  731: Result:=178;
4620
 
  733: Result:=189;
4621
 
  8211..8212: Result:=Unicode-8061;
4622
 
  8216..8217: Result:=Unicode-8071;
4623
 
  8218: Result:=130;
4624
 
  8220..8221: Result:=Unicode-8073;
4625
 
  8222: Result:=132;
4626
 
  8224..8225: Result:=Unicode-8090;
4627
 
  8226: Result:=149;
4628
 
  8230: Result:=133;
4629
 
  8240: Result:=137;
4630
 
  8249: Result:=139;
4631
 
  8250: Result:=155;
4632
 
  8364: Result:=128;
4633
 
  8482: Result:=153;
4634
 
  else Result:=-1;
4635
 
  end;
4636
 
end;
4637
 
 
4638
 
function UnicodeToCP1251(Unicode: cardinal): integer;
4639
 
begin
4640
 
  case Unicode of
4641
 
  0..127: Result:=Unicode;
4642
 
  160: Result:=160;
4643
 
  164: Result:=164;
4644
 
  166..167: Result:=Unicode;
4645
 
  169: Result:=169;
4646
 
  171..174: Result:=Unicode;
4647
 
  176..177: Result:=Unicode;
4648
 
  181..183: Result:=Unicode;
4649
 
  187: Result:=187;
4650
 
  1025: Result:=168;
4651
 
  1026..1027: Result:=Unicode-898;
4652
 
  1028: Result:=170;
4653
 
  1029: Result:=189;
4654
 
  1030: Result:=178;
4655
 
  1031: Result:=175;
4656
 
  1032: Result:=163;
4657
 
  1033: Result:=138;
4658
 
  1034: Result:=140;
4659
 
  1035: Result:=142;
4660
 
  1036: Result:=141;
4661
 
  1038: Result:=161;
4662
 
  1039: Result:=143;
4663
 
  1040..1103: Result:=Unicode-848;
4664
 
  1105: Result:=184;
4665
 
  1106: Result:=144;
4666
 
  1107: Result:=131;
4667
 
  1108: Result:=186;
4668
 
  1109: Result:=190;
4669
 
  1110: Result:=179;
4670
 
  1111: Result:=191;
4671
 
  1112: Result:=188;
4672
 
  1113: Result:=154;
4673
 
  1114: Result:=156;
4674
 
  1115: Result:=158;
4675
 
  1116: Result:=157;
4676
 
  1118: Result:=162;
4677
 
  1119: Result:=159;
4678
 
  1168: Result:=165;
4679
 
  1169: Result:=180;
4680
 
  8211..8212: Result:=Unicode-8061;
4681
 
  8216..8217: Result:=Unicode-8071;
4682
 
  8218: Result:=130;
4683
 
  8220..8221: Result:=Unicode-8073;
4684
 
  8222: Result:=132;
4685
 
  8224..8225: Result:=Unicode-8090;
4686
 
  8226: Result:=149;
4687
 
  8230: Result:=133;
4688
 
  8240: Result:=137;
4689
 
  8249: Result:=139;
4690
 
  8250: Result:=155;
4691
 
  8364: Result:=136;
4692
 
  8470: Result:=185;
4693
 
  8482: Result:=153;
4694
 
  else Result:=-1;
4695
 
  end;
4696
 
end;
4697
 
 
4698
 
function UnicodeToCP1252(Unicode: cardinal): integer;
4699
 
begin
4700
 
  case Unicode of
4701
 
  0..127: Result:=Unicode;
4702
 
  160..255: Result:=Unicode;
4703
 
  338: Result:=140;
4704
 
  339: Result:=156;
4705
 
  352: Result:=138;
4706
 
  353: Result:=154;
4707
 
  376: Result:=159;
4708
 
  381: Result:=142;
4709
 
  382: Result:=158;
4710
 
  402: Result:=131;
4711
 
  710: Result:=136;
4712
 
  732: Result:=152;
4713
 
  8211..8212: Result:=Unicode-8061;
4714
 
  8216..8217: Result:=Unicode-8071;
4715
 
  8218: Result:=130;
4716
 
  8220..8221: Result:=Unicode-8073;
4717
 
  8222: Result:=132;
4718
 
  8224..8225: Result:=Unicode-8090;
4719
 
  8226: Result:=149;
4720
 
  8230: Result:=133;
4721
 
  8240: Result:=137;
4722
 
  8249: Result:=139;
4723
 
  8250: Result:=155;
4724
 
  8364: Result:=128;
4725
 
  8482: Result:=153;
4726
 
  else Result:=-1;
4727
 
  end;
4728
 
end;
4729
 
 
4730
 
function UnicodeToCP1253(Unicode: cardinal): integer;
4731
 
begin
4732
 
  case Unicode of
4733
 
  0..127: Result:=Unicode;
4734
 
  160: Result:=160;
4735
 
  163..169: Result:=Unicode;
4736
 
  171..174: Result:=Unicode;
4737
 
  176..179: Result:=Unicode;
4738
 
  181..183: Result:=Unicode;
4739
 
  187: Result:=187;
4740
 
  189: Result:=189;
4741
 
  402: Result:=131;
4742
 
  900: Result:=180;
4743
 
  901..902: Result:=Unicode-740;
4744
 
  904..906: Result:=Unicode-720;
4745
 
  908: Result:=188;
4746
 
  910..929: Result:=Unicode-720;
4747
 
  931..974: Result:=Unicode-720;
4748
 
  8211..8212: Result:=Unicode-8061;
4749
 
  8213: Result:=175;
4750
 
  8216..8217: Result:=Unicode-8071;
4751
 
  8218: Result:=130;
4752
 
  8220..8221: Result:=Unicode-8073;
4753
 
  8222: Result:=132;
4754
 
  8224..8225: Result:=Unicode-8090;
4755
 
  8226: Result:=149;
4756
 
  8230: Result:=133;
4757
 
  8240: Result:=137;
4758
 
  8249: Result:=139;
4759
 
  8250: Result:=155;
4760
 
  8364: Result:=128;
4761
 
  8482: Result:=153;
4762
 
  else Result:=-1;
4763
 
  end;
4764
 
end;
4765
 
 
4766
 
function UnicodeToCP1254(Unicode: cardinal): integer;
4767
 
begin
4768
 
  case Unicode of
4769
 
  0..127: Result:=Unicode;
4770
 
  160..207: Result:=Unicode;
4771
 
  209..220: Result:=Unicode;
4772
 
  223..239: Result:=Unicode;
4773
 
  241..252: Result:=Unicode;
4774
 
  255: Result:=255;
4775
 
  286: Result:=208;
4776
 
  287: Result:=240;
4777
 
  304: Result:=221;
4778
 
  305: Result:=253;
4779
 
  338: Result:=140;
4780
 
  339: Result:=156;
4781
 
  350: Result:=222;
4782
 
  351: Result:=254;
4783
 
  352: Result:=138;
4784
 
  353: Result:=154;
4785
 
  376: Result:=159;
4786
 
  402: Result:=131;
4787
 
  710: Result:=136;
4788
 
  732: Result:=152;
4789
 
  8211..8212: Result:=Unicode-8061;
4790
 
  8216..8217: Result:=Unicode-8071;
4791
 
  8218: Result:=130;
4792
 
  8220..8221: Result:=Unicode-8073;
4793
 
  8222: Result:=132;
4794
 
  8224..8225: Result:=Unicode-8090;
4795
 
  8226: Result:=149;
4796
 
  8230: Result:=133;
4797
 
  8240: Result:=137;
4798
 
  8249: Result:=139;
4799
 
  8250: Result:=155;
4800
 
  8364: Result:=128;
4801
 
  8482: Result:=153;
4802
 
  else Result:=-1;
4803
 
  end;
4804
 
end;
4805
 
 
4806
 
function UnicodeToCP1255(Unicode: cardinal): integer;
4807
 
begin
4808
 
  case Unicode of
4809
 
  0..127: Result:=Unicode;
4810
 
  160..163: Result:=Unicode;
4811
 
  165..169: Result:=Unicode;
4812
 
  171..185: Result:=Unicode;
4813
 
  187..191: Result:=Unicode;
4814
 
  215: Result:=170;
4815
 
  247: Result:=186;
4816
 
  402: Result:=131;
4817
 
  710: Result:=136;
4818
 
  732: Result:=152;
4819
 
  1456..1465: Result:=Unicode-1264;
4820
 
  1467..1475: Result:=Unicode-1264;
4821
 
  1488..1514: Result:=Unicode-1264;
4822
 
  1520..1524: Result:=Unicode-1308;
4823
 
  8206..8207: Result:=Unicode-7953;
4824
 
  8211..8212: Result:=Unicode-8061;
4825
 
  8216..8217: Result:=Unicode-8071;
4826
 
  8218: Result:=130;
4827
 
  8220..8221: Result:=Unicode-8073;
4828
 
  8222: Result:=132;
4829
 
  8224..8225: Result:=Unicode-8090;
4830
 
  8226: Result:=149;
4831
 
  8230: Result:=133;
4832
 
  8240: Result:=137;
4833
 
  8249: Result:=139;
4834
 
  8250: Result:=155;
4835
 
  8362: Result:=164;
4836
 
  8364: Result:=128;
4837
 
  8482: Result:=153;
4838
 
  else Result:=-1;
4839
 
  end;
4840
 
end;
4841
 
 
4842
 
function UnicodeToCP1256(Unicode: cardinal): integer;
4843
 
begin
4844
 
  case Unicode of
4845
 
  0..127: Result:=Unicode;
4846
 
  160: Result:=160;
4847
 
  162..169: Result:=Unicode;
4848
 
  171..185: Result:=Unicode;
4849
 
  187..190: Result:=Unicode;
4850
 
  215: Result:=215;
4851
 
  224: Result:=224;
4852
 
  226: Result:=226;
4853
 
  231..235: Result:=Unicode;
4854
 
  238..239: Result:=Unicode;
4855
 
  244: Result:=244;
4856
 
  247: Result:=247;
4857
 
  249: Result:=249;
4858
 
  251..252: Result:=Unicode;
4859
 
  338: Result:=140;
4860
 
  339: Result:=156;
4861
 
  402: Result:=131;
4862
 
  710: Result:=136;
4863
 
  1548: Result:=161;
4864
 
  1563: Result:=186;
4865
 
  1567: Result:=191;
4866
 
  1569..1590: Result:=Unicode-1376;
4867
 
  1591..1594: Result:=Unicode-1375;
4868
 
  1600..1603: Result:=Unicode-1380;
4869
 
  1604: Result:=225;
4870
 
  1605..1608: Result:=Unicode-1378;
4871
 
  1609..1610: Result:=Unicode-1373;
4872
 
  1611..1614: Result:=Unicode-1371;
4873
 
  1615..1616: Result:=Unicode-1370;
4874
 
  1617: Result:=248;
4875
 
  1618: Result:=250;
4876
 
  1657: Result:=138;
4877
 
  1662: Result:=129;
4878
 
  1670: Result:=141;
4879
 
  1672: Result:=143;
4880
 
  1681: Result:=154;
4881
 
  1688: Result:=142;
4882
 
  1705: Result:=152;
4883
 
  1711: Result:=144;
4884
 
  1722: Result:=159;
4885
 
  1726: Result:=170;
4886
 
  1729: Result:=192;
4887
 
  1746: Result:=255;
4888
 
  8204..8205: Result:=Unicode-8047;
4889
 
  8206..8207: Result:=Unicode-7953;
4890
 
  8211..8212: Result:=Unicode-8061;
4891
 
  8216..8217: Result:=Unicode-8071;
4892
 
  8218: Result:=130;
4893
 
  8220..8221: Result:=Unicode-8073;
4894
 
  8222: Result:=132;
4895
 
  8224..8225: Result:=Unicode-8090;
4896
 
  8226: Result:=149;
4897
 
  8230: Result:=133;
4898
 
  8240: Result:=137;
4899
 
  8249: Result:=139;
4900
 
  8250: Result:=155;
4901
 
  8364: Result:=128;
4902
 
  8482: Result:=153;
4903
 
  else Result:=-1;
4904
 
  end;
4905
 
end;
4906
 
 
4907
 
function UnicodeToCP1257(Unicode: cardinal): integer;
4908
 
begin
4909
 
  case Unicode of
4910
 
  0..127: Result:=Unicode;
4911
 
  160: Result:=160;
4912
 
  162..164: Result:=Unicode;
4913
 
  166..167: Result:=Unicode;
4914
 
  168: Result:=141;
4915
 
  169: Result:=169;
4916
 
  171..174: Result:=Unicode;
4917
 
  175: Result:=157;
4918
 
  176..183: Result:=Unicode;
4919
 
  184: Result:=143;
4920
 
  185: Result:=185;
4921
 
  187..190: Result:=Unicode;
4922
 
  196..197: Result:=Unicode;
4923
 
  198: Result:=175;
4924
 
  201: Result:=201;
4925
 
  211: Result:=211;
4926
 
  213..215: Result:=Unicode;
4927
 
  216: Result:=168;
4928
 
  220: Result:=220;
4929
 
  223: Result:=223;
4930
 
  228..229: Result:=Unicode;
4931
 
  230: Result:=191;
4932
 
  233: Result:=233;
4933
 
  243: Result:=243;
4934
 
  245..247: Result:=Unicode;
4935
 
  248: Result:=184;
4936
 
  252: Result:=252;
4937
 
  256: Result:=194;
4938
 
  257: Result:=226;
4939
 
  260: Result:=192;
4940
 
  261: Result:=224;
4941
 
  262: Result:=195;
4942
 
  263: Result:=227;
4943
 
  268: Result:=200;
4944
 
  269: Result:=232;
4945
 
  274: Result:=199;
4946
 
  275: Result:=231;
4947
 
  278: Result:=203;
4948
 
  279: Result:=235;
4949
 
  280: Result:=198;
4950
 
  281: Result:=230;
4951
 
  290: Result:=204;
4952
 
  291: Result:=236;
4953
 
  298: Result:=206;
4954
 
  299: Result:=238;
4955
 
  302: Result:=193;
4956
 
  303: Result:=225;
4957
 
  310: Result:=205;
4958
 
  311: Result:=237;
4959
 
  315: Result:=207;
4960
 
  316: Result:=239;
4961
 
  321: Result:=217;
4962
 
  322: Result:=249;
4963
 
  323: Result:=209;
4964
 
  324: Result:=241;
4965
 
  325: Result:=210;
4966
 
  326: Result:=242;
4967
 
  332: Result:=212;
4968
 
  333: Result:=244;
4969
 
  342: Result:=170;
4970
 
  343: Result:=186;
4971
 
  346: Result:=218;
4972
 
  347: Result:=250;
4973
 
  352: Result:=208;
4974
 
  353: Result:=240;
4975
 
  362: Result:=219;
4976
 
  363: Result:=251;
4977
 
  370: Result:=216;
4978
 
  371: Result:=248;
4979
 
  377: Result:=202;
4980
 
  378: Result:=234;
4981
 
  379: Result:=221;
4982
 
  380: Result:=253;
4983
 
  381: Result:=222;
4984
 
  382: Result:=254;
4985
 
  711: Result:=142;
4986
 
  729: Result:=255;
4987
 
  731: Result:=158;
4988
 
  8211..8212: Result:=Unicode-8061;
4989
 
  8216..8217: Result:=Unicode-8071;
4990
 
  8218: Result:=130;
4991
 
  8220..8221: Result:=Unicode-8073;
4992
 
  8222: Result:=132;
4993
 
  8224..8225: Result:=Unicode-8090;
4994
 
  8226: Result:=149;
4995
 
  8230: Result:=133;
4996
 
  8240: Result:=137;
4997
 
  8249: Result:=139;
4998
 
  8250: Result:=155;
4999
 
  8364: Result:=128;
5000
 
  8482: Result:=153;
5001
 
  else Result:=-1;
5002
 
  end;
5003
 
end;
5004
 
 
5005
 
function UnicodeToCP1258(Unicode: cardinal): integer;
5006
 
begin
5007
 
  case Unicode of
5008
 
  0..127: Result:=Unicode;
5009
 
  160..194: Result:=Unicode;
5010
 
  196..203: Result:=Unicode;
5011
 
  205..207: Result:=Unicode;
5012
 
  209: Result:=209;
5013
 
  211..212: Result:=Unicode;
5014
 
  214..220: Result:=Unicode;
5015
 
  223..226: Result:=Unicode;
5016
 
  228..235: Result:=Unicode;
5017
 
  237..239: Result:=Unicode;
5018
 
  241: Result:=241;
5019
 
  243..244: Result:=Unicode;
5020
 
  246..252: Result:=Unicode;
5021
 
  255: Result:=255;
5022
 
  258: Result:=195;
5023
 
  259: Result:=227;
5024
 
  272: Result:=208;
5025
 
  273: Result:=240;
5026
 
  338: Result:=140;
5027
 
  339: Result:=156;
5028
 
  376: Result:=159;
5029
 
  402: Result:=131;
5030
 
  416: Result:=213;
5031
 
  417: Result:=245;
5032
 
  431: Result:=221;
5033
 
  432: Result:=253;
5034
 
  710: Result:=136;
5035
 
  732: Result:=152;
5036
 
  768: Result:=204;
5037
 
  769: Result:=236;
5038
 
  771: Result:=222;
5039
 
  777: Result:=210;
5040
 
  803: Result:=242;
5041
 
  8211..8212: Result:=Unicode-8061;
5042
 
  8216..8217: Result:=Unicode-8071;
5043
 
  8218: Result:=130;
5044
 
  8220..8221: Result:=Unicode-8073;
5045
 
  8222: Result:=132;
5046
 
  8224..8225: Result:=Unicode-8090;
5047
 
  8226: Result:=149;
5048
 
  8230: Result:=133;
5049
 
  8240: Result:=137;
5050
 
  8249: Result:=139;
5051
 
  8250: Result:=155;
5052
 
  8363: Result:=254;
5053
 
  8364: Result:=128;
5054
 
  8482: Result:=153;
5055
 
  else Result:=-1;
5056
 
  end;
5057
 
end;
5058
 
 
5059
 
function UnicodeToCP437(Unicode: cardinal): integer;
5060
 
begin
5061
 
  case Unicode of
5062
 
  0..127: Result:=Unicode;
5063
 
  160: Result:=255;
5064
 
  161: Result:=173;
5065
 
  162..163: Result:=Unicode-7;
5066
 
  165: Result:=157;
5067
 
  170: Result:=166;
5068
 
  171: Result:=174;
5069
 
  172: Result:=170;
5070
 
  176: Result:=248;
5071
 
  177: Result:=241;
5072
 
  178: Result:=253;
5073
 
  181: Result:=230;
5074
 
  183: Result:=250;
5075
 
  186: Result:=167;
5076
 
  187: Result:=175;
5077
 
  188: Result:=172;
5078
 
  189: Result:=171;
5079
 
  191: Result:=168;
5080
 
  196..197: Result:=Unicode-54;
5081
 
  198: Result:=146;
5082
 
  199: Result:=128;
5083
 
  201: Result:=144;
5084
 
  209: Result:=165;
5085
 
  214: Result:=153;
5086
 
  220: Result:=154;
5087
 
  223: Result:=225;
5088
 
  224: Result:=133;
5089
 
  225: Result:=160;
5090
 
  226: Result:=131;
5091
 
  228: Result:=132;
5092
 
  229: Result:=134;
5093
 
  230: Result:=145;
5094
 
  231: Result:=135;
5095
 
  232: Result:=138;
5096
 
  233: Result:=130;
5097
 
  234..235: Result:=Unicode-98;
5098
 
  236: Result:=141;
5099
 
  237: Result:=161;
5100
 
  238: Result:=140;
5101
 
  239: Result:=139;
5102
 
  241: Result:=164;
5103
 
  242: Result:=149;
5104
 
  243: Result:=162;
5105
 
  244: Result:=147;
5106
 
  246: Result:=148;
5107
 
  247: Result:=246;
5108
 
  249: Result:=151;
5109
 
  250: Result:=163;
5110
 
  251: Result:=150;
5111
 
  252: Result:=129;
5112
 
  255: Result:=152;
5113
 
  402: Result:=159;
5114
 
  915: Result:=226;
5115
 
  920: Result:=233;
5116
 
  931: Result:=228;
5117
 
  934: Result:=232;
5118
 
  937: Result:=234;
5119
 
  945: Result:=224;
5120
 
  948: Result:=235;
5121
 
  949: Result:=238;
5122
 
  960: Result:=227;
5123
 
  963: Result:=229;
5124
 
  964: Result:=231;
5125
 
  966: Result:=237;
5126
 
  8319: Result:=252;
5127
 
  8359: Result:=158;
5128
 
  8729: Result:=249;
5129
 
  8730: Result:=251;
5130
 
  8734: Result:=236;
5131
 
  8745: Result:=239;
5132
 
  8776: Result:=247;
5133
 
  8801: Result:=240;
5134
 
  8804: Result:=243;
5135
 
  8805: Result:=242;
5136
 
  8976: Result:=169;
5137
 
  8992..8993: Result:=Unicode-8748;
5138
 
  9472: Result:=196;
5139
 
  9474: Result:=179;
5140
 
  9484: Result:=218;
5141
 
  9488: Result:=191;
5142
 
  9492: Result:=192;
5143
 
  9496: Result:=217;
5144
 
  9500: Result:=195;
5145
 
  9508: Result:=180;
5146
 
  9516: Result:=194;
5147
 
  9524: Result:=193;
5148
 
  9532: Result:=197;
5149
 
  9552: Result:=205;
5150
 
  9553: Result:=186;
5151
 
  9554..9555: Result:=Unicode-9341;
5152
 
  9556: Result:=201;
5153
 
  9557: Result:=184;
5154
 
  9558: Result:=183;
5155
 
  9559: Result:=187;
5156
 
  9560: Result:=212;
5157
 
  9561: Result:=211;
5158
 
  9562: Result:=200;
5159
 
  9563: Result:=190;
5160
 
  9564: Result:=189;
5161
 
  9565: Result:=188;
5162
 
  9566..9567: Result:=Unicode-9368;
5163
 
  9568: Result:=204;
5164
 
  9569..9570: Result:=Unicode-9388;
5165
 
  9571: Result:=185;
5166
 
  9572..9573: Result:=Unicode-9363;
5167
 
  9574: Result:=203;
5168
 
  9575..9576: Result:=Unicode-9368;
5169
 
  9577: Result:=202;
5170
 
  9578: Result:=216;
5171
 
  9579: Result:=215;
5172
 
  9580: Result:=206;
5173
 
  9600: Result:=223;
5174
 
  9604: Result:=220;
5175
 
  9608: Result:=219;
5176
 
  9612: Result:=221;
5177
 
  9616: Result:=222;
5178
 
  9617..9619: Result:=Unicode-9441;
5179
 
  9632: Result:=254;
5180
 
  else Result:=-1;
5181
 
  end;
5182
 
end;
5183
 
 
5184
 
function UnicodeToCP850(Unicode: cardinal): integer;
5185
 
begin
5186
 
  case Unicode of
5187
 
  0..127: Result:=Unicode;
5188
 
  160: Result:=255;
5189
 
  161: Result:=173;
5190
 
  162: Result:=189;
5191
 
  163: Result:=156;
5192
 
  164: Result:=207;
5193
 
  165: Result:=190;
5194
 
  166: Result:=221;
5195
 
  167: Result:=245;
5196
 
  168: Result:=249;
5197
 
  169: Result:=184;
5198
 
  170: Result:=166;
5199
 
  171: Result:=174;
5200
 
  172: Result:=170;
5201
 
  173: Result:=240;
5202
 
  174: Result:=169;
5203
 
  175: Result:=238;
5204
 
  176: Result:=248;
5205
 
  177: Result:=241;
5206
 
  178: Result:=253;
5207
 
  179: Result:=252;
5208
 
  180: Result:=239;
5209
 
  181: Result:=230;
5210
 
  182: Result:=244;
5211
 
  183: Result:=250;
5212
 
  184: Result:=247;
5213
 
  185: Result:=251;
5214
 
  186: Result:=167;
5215
 
  187: Result:=175;
5216
 
  188: Result:=172;
5217
 
  189: Result:=171;
5218
 
  190: Result:=243;
5219
 
  191: Result:=168;
5220
 
  192: Result:=183;
5221
 
  193..194: Result:=Unicode-12;
5222
 
  195: Result:=199;
5223
 
  196..197: Result:=Unicode-54;
5224
 
  198: Result:=146;
5225
 
  199: Result:=128;
5226
 
  200: Result:=212;
5227
 
  201: Result:=144;
5228
 
  202..203: Result:=Unicode--8;
5229
 
  204: Result:=222;
5230
 
  205..207: Result:=Unicode--9;
5231
 
  208: Result:=209;
5232
 
  209: Result:=165;
5233
 
  210: Result:=227;
5234
 
  211: Result:=224;
5235
 
  212: Result:=226;
5236
 
  213: Result:=229;
5237
 
  214: Result:=153;
5238
 
  215: Result:=158;
5239
 
  216: Result:=157;
5240
 
  217: Result:=235;
5241
 
  218..219: Result:=Unicode--15;
5242
 
  220: Result:=154;
5243
 
  221: Result:=237;
5244
 
  222: Result:=232;
5245
 
  223: Result:=225;
5246
 
  224: Result:=133;
5247
 
  225: Result:=160;
5248
 
  226: Result:=131;
5249
 
  227: Result:=198;
5250
 
  228: Result:=132;
5251
 
  229: Result:=134;
5252
 
  230: Result:=145;
5253
 
  231: Result:=135;
5254
 
  232: Result:=138;
5255
 
  233: Result:=130;
5256
 
  234..235: Result:=Unicode-98;
5257
 
  236: Result:=141;
5258
 
  237: Result:=161;
5259
 
  238: Result:=140;
5260
 
  239: Result:=139;
5261
 
  240: Result:=208;
5262
 
  241: Result:=164;
5263
 
  242: Result:=149;
5264
 
  243: Result:=162;
5265
 
  244: Result:=147;
5266
 
  245: Result:=228;
5267
 
  246: Result:=148;
5268
 
  247: Result:=246;
5269
 
  248: Result:=155;
5270
 
  249: Result:=151;
5271
 
  250: Result:=163;
5272
 
  251: Result:=150;
5273
 
  252: Result:=129;
5274
 
  253: Result:=236;
5275
 
  254: Result:=231;
5276
 
  255: Result:=152;
5277
 
  305: Result:=213;
5278
 
  402: Result:=159;
5279
 
  8215: Result:=242;
5280
 
  9472: Result:=196;
5281
 
  9474: Result:=179;
5282
 
  9484: Result:=218;
5283
 
  9488: Result:=191;
5284
 
  9492: Result:=192;
5285
 
  9496: Result:=217;
5286
 
  9500: Result:=195;
5287
 
  9508: Result:=180;
5288
 
  9516: Result:=194;
5289
 
  9524: Result:=193;
5290
 
  9532: Result:=197;
5291
 
  9552: Result:=205;
5292
 
  9553: Result:=186;
5293
 
  9556: Result:=201;
5294
 
  9559: Result:=187;
5295
 
  9562: Result:=200;
5296
 
  9565: Result:=188;
5297
 
  9568: Result:=204;
5298
 
  9571: Result:=185;
5299
 
  9574: Result:=203;
5300
 
  9577: Result:=202;
5301
 
  9580: Result:=206;
5302
 
  9600: Result:=223;
5303
 
  9604: Result:=220;
5304
 
  9608: Result:=219;
5305
 
  9617..9619: Result:=Unicode-9441;
5306
 
  9632: Result:=254;
5307
 
  else Result:=-1;
5308
 
  end;
5309
 
end;
5310
 
 
5311
 
function UnicodeToCP866(Unicode: cardinal): integer;
5312
 
begin
5313
 
  case Unicode of
5314
 
  0..127: Result:=Unicode;
5315
 
  1040..1087 : Result := Unicode-912;
5316
 
  9617..9619 : Result := Unicode-9441;
5317
 
  9474 : Result := 179;
5318
 
  9508 : Result := 180;
5319
 
  9569 : Result := 181;
5320
 
  9570 : Result := 182;
5321
 
  9558 : Result := 183;
5322
 
  9557 : Result := 184;
5323
 
  9571 : Result := 185;
5324
 
  9553 : Result := 186;
5325
 
  9559 : Result := 187;
5326
 
  9565 : Result := 188;
5327
 
  9564 : Result := 189;
5328
 
  9563 : Result := 190;
5329
 
  9488 : Result := 191;
5330
 
  9492 : Result := 192;
5331
 
  9524 : Result := 193;
5332
 
  9516 : Result := 194;
5333
 
  9500 : Result := 195;
5334
 
  9472 : Result := 196;
5335
 
  9532 : Result := 197;
5336
 
  9566 : Result := 198;
5337
 
  9567 : Result := 199;
5338
 
  9562 : Result := 200;
5339
 
  9556 : Result := 201;
5340
 
  9577 : Result := 202;
5341
 
  9574 : Result := 203;
5342
 
  9568 : Result := 204;
5343
 
  9552 : Result := 205;
5344
 
  9580 : Result := 206;
5345
 
  9575 : Result := 207;
5346
 
  9576 : Result := 208;
5347
 
  9572 : Result := 209;
5348
 
  9573 : Result := 210;
5349
 
  9561 : Result := 211;
5350
 
  9560 : Result := 212;
5351
 
  9554 : Result := 213;
5352
 
  9555 : Result := 214;
5353
 
  9579 : Result := 215;
5354
 
  9578 : Result := 216;
5355
 
  9496 : Result := 217;
5356
 
  9484 : Result := 218;
5357
 
  9608 : Result := 219;
5358
 
  9604 : Result := 220;
5359
 
  9612 : Result := 221;
5360
 
  9616 : Result := 222;
5361
 
  9600 : Result := 223;
5362
 
  1088..1103 : Result := Unicode-864;
5363
 
  1025 : Result := 240;
5364
 
  1105 : Result := 241;
5365
 
  1028 : Result := 242;
5366
 
  1108 : Result := 243;
5367
 
  1031 : Result := 244;
5368
 
  1111 : Result := 245;
5369
 
  1038 : Result := 246;
5370
 
  1118 : Result := 247;
5371
 
  176  : Result := 248;
5372
 
  8729 : Result := 249;
5373
 
  183  : Result := 250;
5374
 
  8730 : Result := 251;
5375
 
  8470 : Result := 252;
5376
 
  164  : Result := 253;
5377
 
  9632 : Result := 254;
5378
 
  160  : Result := 255;
5379
 
  else Result:=-1;
5380
 
  end;
5381
 
end;
5382
 
 
5383
 
function UnicodeToCP874(Unicode: cardinal): integer;
5384
 
begin
5385
 
  case Unicode of
5386
 
  0..127: Result:=Unicode;
5387
 
  160: Result:=160;
5388
 
  3585..3642: Result:=Unicode-3424;
5389
 
  3647..3675: Result:=Unicode-3424;
5390
 
  8211..8212: Result:=Unicode-8061;
5391
 
  8216..8217: Result:=Unicode-8071;
5392
 
  8220..8221: Result:=Unicode-8073;
5393
 
  8226: Result:=149;
5394
 
  8230: Result:=133;
5395
 
  8364: Result:=128;
5396
 
  else Result:=-1;
5397
 
  end;
5398
 
end;
5399
 
 
5400
 
function UnicodeToKOI8(Unicode: cardinal): integer;
5401
 
begin
5402
 
  case Unicode of
5403
 
  0..127: Result:=Unicode;
5404
 
  1040..1041: Result:=Unicode-815;
5405
 
  1042: Result:=247;
5406
 
  1043: Result:=231;
5407
 
  1044..1045: Result:=Unicode-816;
5408
 
  1046: Result:=246;
5409
 
  1047: Result:=250;
5410
 
  1048..1055: Result:=Unicode-815;
5411
 
  1056..1059: Result:=Unicode-814;
5412
 
  1060: Result:=230;
5413
 
  1061: Result:=232;
5414
 
  1062: Result:=227;
5415
 
  1063: Result:=254;
5416
 
  1064: Result:=251;
5417
 
  1065: Result:=253;
5418
 
  1067: Result:=249;
5419
 
  1068: Result:=248;
5420
 
  1069: Result:=252;
5421
 
  1070: Result:=224;
5422
 
  1071: Result:=241;
5423
 
  1072..1073: Result:=Unicode-879;
5424
 
  1074: Result:=215;
5425
 
  1075: Result:=199;
5426
 
  1076..1077: Result:=Unicode-880;
5427
 
  1078: Result:=214;
5428
 
  1079: Result:=218;
5429
 
  1080..1087: Result:=Unicode-879;
5430
 
  1088..1091: Result:=Unicode-878;
5431
 
  1092: Result:=198;
5432
 
  1093: Result:=200;
5433
 
  1094: Result:=195;
5434
 
  1095: Result:=222;
5435
 
  1096: Result:=219;
5436
 
  1097: Result:=221;
5437
 
  1098: Result:=223;
5438
 
  1099: Result:=217;
5439
 
  1100: Result:=216;
5440
 
  1101: Result:=220;
5441
 
  1102: Result:=192;
5442
 
  1103: Result:=209;
5443
 
  else Result:=-1;
5444
 
  end;
5445
 
end;
5446
 
 
5447
 
function UnicodeToISO_8859_1(Unicode: cardinal): integer;
5448
 
begin
5449
 
  case Unicode of
5450
 
  0..255: Result:=Unicode;
5451
 
  else Result:=-1;
5452
 
  end;
5453
 
end;
5454
 
 
5455
 
function UnicodeToISO_8859_2(Unicode: cardinal): integer;
5456
 
begin
5457
 
  case Unicode of
5458
 
  0..127: Result:=Unicode;
5459
 
  128..160: Result:=Unicode;
5460
 
  164: Result:=164;
5461
 
  167..168: Result:=Unicode;
5462
 
  173: Result:=173;
5463
 
  176: Result:=176;
5464
 
  180: Result:=180;
5465
 
  184: Result:=184;
5466
 
  193..194: Result:=Unicode;
5467
 
  196: Result:=196;
5468
 
  199: Result:=199;
5469
 
  201: Result:=201;
5470
 
  203: Result:=203;
5471
 
  205..206: Result:=Unicode;
5472
 
  211..212: Result:=Unicode;
5473
 
  214..215: Result:=Unicode;
5474
 
  218: Result:=218;
5475
 
  220..221: Result:=Unicode;
5476
 
  223: Result:=223;
5477
 
  225..226: Result:=Unicode;
5478
 
  228: Result:=228;
5479
 
  231: Result:=231;
5480
 
  233: Result:=233;
5481
 
  235: Result:=235;
5482
 
  237..238: Result:=Unicode;
5483
 
  243..244: Result:=Unicode;
5484
 
  246..247: Result:=Unicode;
5485
 
  250: Result:=250;
5486
 
  252..253: Result:=Unicode;
5487
 
  258: Result:=195;
5488
 
  259: Result:=227;
5489
 
  260: Result:=161;
5490
 
  261: Result:=177;
5491
 
  262: Result:=198;
5492
 
  263: Result:=230;
5493
 
  268: Result:=200;
5494
 
  269: Result:=232;
5495
 
  270: Result:=207;
5496
 
  271: Result:=239;
5497
 
  272: Result:=208;
5498
 
  273: Result:=240;
5499
 
  280: Result:=202;
5500
 
  281: Result:=234;
5501
 
  282: Result:=204;
5502
 
  283: Result:=236;
5503
 
  313: Result:=197;
5504
 
  314: Result:=229;
5505
 
  317: Result:=165;
5506
 
  318: Result:=181;
5507
 
  321: Result:=163;
5508
 
  322: Result:=179;
5509
 
  323: Result:=209;
5510
 
  324: Result:=241;
5511
 
  327: Result:=210;
5512
 
  328: Result:=242;
5513
 
  336: Result:=213;
5514
 
  337: Result:=245;
5515
 
  340: Result:=192;
5516
 
  341: Result:=224;
5517
 
  344: Result:=216;
5518
 
  345: Result:=248;
5519
 
  346: Result:=166;
5520
 
  347: Result:=182;
5521
 
  350: Result:=170;
5522
 
  351: Result:=186;
5523
 
  352: Result:=169;
5524
 
  353: Result:=185;
5525
 
  354: Result:=222;
5526
 
  355: Result:=254;
5527
 
  356: Result:=171;
5528
 
  357: Result:=187;
5529
 
  366: Result:=217;
5530
 
  367: Result:=249;
5531
 
  368: Result:=219;
5532
 
  369: Result:=251;
5533
 
  377: Result:=172;
5534
 
  378: Result:=188;
5535
 
  379: Result:=175;
5536
 
  380: Result:=191;
5537
 
  381: Result:=174;
5538
 
  382: Result:=190;
5539
 
  711: Result:=183;
5540
 
  728: Result:=162;
5541
 
  729: Result:=255;
5542
 
  731: Result:=178;
5543
 
  733: Result:=189;
5544
 
  else Result:=-1;
5545
 
  end;
5546
 
end;
5547
 
 
5548
 
function UTF8ToUTF8BOM(const s: string): string;
5549
 
begin
5550
 
  Result:=#$EF#$BB#$BF+s;
5551
 
end;
5552
 
 
5553
 
function UTF8ToISO_8859_1(const s: string): string;
5554
 
begin
5555
 
  Result:=UTF8ToSingleByte(s,@UnicodeToISO_8859_1);
5556
 
end;
5557
 
 
5558
 
function UTF8ToISO_8859_2(const s: string): string;
5559
 
begin
5560
 
  Result:=UTF8ToSingleByte(s,@UnicodeToISO_8859_2);
5561
 
end;
5562
 
 
5563
 
function UTF8ToCP1250(const s: string): string;
5564
 
begin
5565
 
  Result:=UTF8ToSingleByte(s,@UnicodeToCP1250);
5566
 
end;
5567
 
 
5568
 
function UTF8ToCP1251(const s: string): string;
5569
 
begin
5570
 
  Result:=UTF8ToSingleByte(s,@UnicodeToCP1251);
5571
 
end;
5572
 
 
5573
 
function UTF8ToCP1252(const s: string): string;
5574
 
begin
5575
 
  Result:=UTF8ToSingleByte(s,@UnicodeToCP1252);
5576
 
end;
5577
 
 
5578
 
function UTF8ToCP1253(const s: string): string;
5579
 
begin
5580
 
  Result:=UTF8ToSingleByte(s,@UnicodeToCP1253);
5581
 
end;
5582
 
 
5583
 
function UTF8ToCP1254(const s: string): string;
5584
 
begin
5585
 
  Result:=UTF8ToSingleByte(s,@UnicodeToCP1254);
5586
 
end;
5587
 
 
5588
 
function UTF8ToCP1255(const s: string): string;
5589
 
begin
5590
 
  Result:=UTF8ToSingleByte(s,@UnicodeToCP1255);
5591
 
end;
5592
 
 
5593
 
function UTF8ToCP1256(const s: string): string;
5594
 
begin
5595
 
  Result:=UTF8ToSingleByte(s,@UnicodeToCP1256);
5596
 
end;
5597
 
 
5598
 
function UTF8ToCP1257(const s: string): string;
5599
 
begin
5600
 
  Result:=UTF8ToSingleByte(s,@UnicodeToCP1257);
5601
 
end;
5602
 
 
5603
 
function UTF8ToCP1258(const s: string): string;
5604
 
begin
5605
 
  Result:=UTF8ToSingleByte(s,@UnicodeToCP1258);
5606
 
end;
5607
 
 
5608
 
function UTF8ToCP437(const s: string): string;
5609
 
begin
5610
 
  Result:=UTF8ToSingleByte(s,@UnicodeToCP437);
5611
 
end;
5612
 
 
5613
 
function UTF8ToCP850(const s: string): string;
5614
 
begin
5615
 
  Result:=UTF8ToSingleByte(s,@UnicodeToCP850);
5616
 
end;
5617
 
 
5618
 
function UTF8ToCP866(const s: string): string;
5619
 
begin
5620
 
  Result:=UTF8ToSingleByte(s,@UnicodeToCP866);
5621
 
end;
5622
 
 
5623
 
function UTF8ToCP874(const s: string): string;
5624
 
begin
5625
 
  Result:=UTF8ToSingleByte(s,@UnicodeToCP874);
5626
 
end;
5627
 
 
5628
 
function UTF8ToKOI8(const s: string): string;
5629
 
begin
5630
 
  Result:=UTF8ToSingleByte(s,@UnicodeToKOI8);
5631
 
end;
5632
 
 
5633
 
function UTF8ToSingleByte(const s: string;
5634
 
  const UTF8CharConvFunc: TUnicodeToCharID): string;
5635
 
var
5636
 
  len: Integer;
5637
 
  Src: PChar;
5638
 
  Dest: PChar;
5639
 
  c: Char;
5640
 
  Unicode: LongWord;
5641
 
  CharLen: integer;
5642
 
  i: integer;
5643
 
begin
5644
 
  if s='' then begin
5645
 
    Result:='';
5646
 
    exit;
5647
 
  end;
5648
 
  len:=length(s);
5649
 
  SetLength(Result,len);
5650
 
  Src:=PChar(s);
5651
 
  Dest:=PChar(Result);
5652
 
  while len>0 do begin
5653
 
    c:=Src^;
5654
 
    if c<#128 then begin
5655
 
      Dest^:=c;
5656
 
      inc(Dest);
5657
 
      inc(Src);
5658
 
      dec(len);
5659
 
    end else begin
5660
 
      Unicode:=UTF8CharacterToUnicode(Src,CharLen);
5661
 
      inc(Src,CharLen);
5662
 
      dec(len,CharLen);
5663
 
      i:=UTF8CharConvFunc(Unicode);
5664
 
      if i>=0 then begin
5665
 
        Dest^:=chr(i);
5666
 
        inc(Dest);
5667
 
      end;
5668
 
    end;
5669
 
  end;
5670
 
  SetLength(Result,Dest-PChar(Result));
5671
 
end;
5672
 
 
5673
 
function UTF8ToUCS2LE(const s: string): string;
5674
 
var
5675
 
  len: Integer;
5676
 
  Src: PChar;
5677
 
  Dest: PWord;
5678
 
  c: Char;
5679
 
  Unicode: LongWord;
5680
 
  CharLen: integer;
5681
 
begin
5682
 
  if s='' then begin
5683
 
    Result:='';
5684
 
    exit;
5685
 
  end;
5686
 
  len:=length(s);
5687
 
  SetLength(Result,len*2);
5688
 
  Src:=PChar(s);
5689
 
  Dest:=PWord(Pointer(Result));
5690
 
  while len>0 do begin
5691
 
    c:=Src^;
5692
 
    if c<#128 then begin
5693
 
      Dest^:=NtoLE(Word(ord(c)));
5694
 
      inc(Dest);
5695
 
      inc(Src);
5696
 
      dec(len);
5697
 
    end else begin
5698
 
      Unicode:=UTF8CharacterToUnicode(Src,CharLen);
5699
 
      inc(Src,CharLen);
5700
 
      dec(len,CharLen);
5701
 
      if Unicode<=$ffff then begin
5702
 
        Dest^:=NtoLE(Word(Unicode));
5703
 
        inc(Dest);
5704
 
      end;
5705
 
    end;
5706
 
  end;
5707
 
  len:=PtrUInt(Dest)-PtrUInt(Result);
5708
 
  if len>length(Result) then
5709
 
    RaiseGDBException('');
5710
 
  SetLength(Result,len);
5711
 
end;
5712
 
 
5713
 
function UTF8ToUCS2BE(const s: string): string;
5714
 
var
5715
 
  len: Integer;
5716
 
  Src: PChar;
5717
 
  Dest: PWord;
5718
 
  c: Char;
5719
 
  Unicode: LongWord;
5720
 
  CharLen: integer;
5721
 
begin
5722
 
  if s='' then begin
5723
 
    Result:='';
5724
 
    exit;
5725
 
  end;
5726
 
  len:=length(s);
5727
 
  SetLength(Result,len*2);
5728
 
  Src:=PChar(s);
5729
 
  Dest:=PWord(Pointer(Result));
5730
 
  while len>0 do begin
5731
 
    c:=Src^;
5732
 
    if c<#128 then begin
5733
 
      Dest^:=NtoBE(Word(ord(c)));
5734
 
      inc(Dest);
5735
 
      inc(Src);
5736
 
      dec(len);
5737
 
    end else begin
5738
 
      Unicode:=UTF8CharacterToUnicode(Src,CharLen);
5739
 
      inc(Src,CharLen);
5740
 
      dec(len,CharLen);
5741
 
      if Unicode<=$ffff then begin
5742
 
        Dest^:=NtoBE(Word(Unicode));
5743
 
        inc(Dest);
5744
 
      end;
5745
 
    end;
5746
 
  end;
5747
 
  len:=PtrUInt(Dest)-PtrUInt(Result);
5748
 
  if len>length(Result) then
5749
 
    RaiseGDBException('');
5750
 
  SetLength(Result,len);
5751
 
end;
5752
 
 
5753
 
procedure GetSupportedEncodings(List: TStrings);
5754
 
begin
5755
 
  List.Add('UTF-8');
5756
 
  List.Add('UTF-8BOM');
5757
 
  List.Add('Ansi');
5758
 
  List.Add('CP1250');
5759
 
  List.Add('CP1251');
5760
 
  List.Add('CP1252');
5761
 
  List.Add('CP1253');
5762
 
  List.Add('CP1254');
5763
 
  List.Add('CP1255');
5764
 
  List.Add('CP1256');
5765
 
  List.Add('CP1257');
5766
 
  List.Add('CP1258');
5767
 
  List.Add('CP437');
5768
 
  List.Add('CP850');
5769
 
  List.Add('CP866');
5770
 
  List.Add('CP874');
5771
 
  List.Add('CP936');
5772
 
  List.Add('CP950');
5773
 
  List.Add('CP949');
5774
 
  List.Add('CP932');  
5775
 
  List.Add('ISO-8859-1');
5776
 
  List.Add('ISO-8859-2');
5777
 
  List.Add('KOI-8');
5778
 
  List.Add('UCS-2LE');
5779
 
  List.Add('UCS-2BE');
5780
 
end;
5781
 
 
5782
 
function GuessEncoding(const s: string): string;
5783
 
 
5784
 
  function CompareI(p1, p2: PChar; Count: integer): boolean;
5785
 
  var
5786
 
    i: Integer;
5787
 
    Chr1: Byte;
5788
 
    Chr2: Byte;
5789
 
  begin
5790
 
    for i:=1 to Count do begin
5791
 
      Chr1 := byte(p1^);
5792
 
      Chr2 := byte(p2^);
5793
 
      if Chr1<>Chr2 then begin
5794
 
        if Chr1 in [97..122] then
5795
 
          dec(Chr1,32);
5796
 
        if Chr2 in [97..122] then
5797
 
          dec(Chr2,32);
5798
 
        if Chr1<>Chr2 then exit(false);
5799
 
      end;
5800
 
      inc(p1);
5801
 
      inc(p2);
5802
 
    end;
5803
 
    Result:=true;
5804
 
  end;
5805
 
  
5806
 
  {$IFDEF VerboseIDEEncoding}
5807
 
  function PosToStr(p: integer): string;
5808
 
  var
5809
 
    y: Integer;
5810
 
    x: Integer;
5811
 
    i: Integer;
5812
 
  begin
5813
 
    y:=1;
5814
 
    x:=1;
5815
 
    i:=1;
5816
 
    while (i<=length(s)) and (i<p) do begin
5817
 
      if s[i] in [#10,#13] then begin
5818
 
        inc(i);
5819
 
        x:=1;
5820
 
        inc(y);
5821
 
        if (i<=length(s)) and (s[i] in [#10,#13]) and (s[i]<>s[i-1]) then
5822
 
          inc(i);
5823
 
      end else begin
5824
 
        inc(i);
5825
 
        inc(x);
5826
 
      end;
5827
 
    end;
5828
 
    Result:='x='+IntToStr(x)+',y='+IntToStr(y);
5829
 
  end;
5830
 
  {$ENDIF}
5831
 
 
5832
 
var
5833
 
  l: Integer;
5834
 
  p: Integer;
5835
 
  EndPos: LongInt;
5836
 
  i: LongInt;
5837
 
begin
5838
 
  l:=length(s);
5839
 
  if l=0 then begin
5840
 
    Result:='';
5841
 
    exit;
5842
 
  end;
5843
 
  
5844
 
  // try UTF-8 BOM (Byte Order Mark)
5845
 
  if CompareI(@s[1],#$EF#$BB#$BF,3) then begin
5846
 
    Result:=EncodingUTF8BOM;
5847
 
    exit;
5848
 
  end;
5849
 
 
5850
 
  // try ucs-2le BOM FF FE
5851
 
  if (length(s)>=2) and (s[1]=#$FF) and (s[2]=#$FE) then begin
5852
 
    Result:=EncodingUCS2LE;
5853
 
    exit;
5854
 
  end;
5855
 
 
5856
 
  // try ucs-2be BOM FE FF
5857
 
  if (length(s)>=2) and (s[1]=#$FE) and (s[2]=#$FF) then begin
5858
 
    Result:=EncodingUCS2BE;
5859
 
    exit;
5860
 
  end;
5861
 
 
5862
 
  // try {%encoding eee}
5863
 
  if CompareI(@s[1],'{%encoding ',11) then begin
5864
 
    p:=12;
5865
 
    while (p<=l) and (s[p] in [' ',#9]) do inc(p);
5866
 
    EndPos:=p;
5867
 
    while (EndPos<=l) and (not (s[EndPos] in ['}',' ',#9])) do inc(EndPos);
5868
 
    Result:=NormalizeEncoding(copy(s,p,EndPos-p));
5869
 
    exit;
5870
 
  end;
5871
 
  
5872
 
  // try UTF-8 (this includes ASCII)
5873
 
  p:=1;
5874
 
  while (p<=l) do begin
5875
 
    if ord(s[p])<128 then begin
5876
 
      // ASCII
5877
 
      inc(p);
5878
 
    end else begin
5879
 
      i:=UTF8CharacterStrictLength(@s[p]);
5880
 
      //DebugLn(['GuessEncoding ',i,' ',DbgStr(s[p])]);
5881
 
      if i=0 then begin
5882
 
        {$IFDEF VerboseIDEEncoding}
5883
 
        DebugLn(['GuessEncoding non UTF-8 found at ',PosToStr(p),' ',dbgstr(copy(s,p-10,20))]);
5884
 
        {$ENDIF}
5885
 
        break;
5886
 
      end;
5887
 
      inc(p,i);
5888
 
    end;
5889
 
  end;
5890
 
  if p>l then begin
5891
 
    Result:=EncodingUTF8;
5892
 
    exit;
5893
 
  end;
5894
 
  
5895
 
  // use system encoding
5896
 
  Result:=GetDefaultTextEncoding;
5897
 
 
5898
 
  if NormalizeEncoding(Result)=EncodingUTF8 then begin
5899
 
    // the system encoding is UTF-8, but it is not UTF-8
5900
 
    // use ISO-8859-1 instead. This encoding has a full 1:1 mapping to unicode,
5901
 
    // so no character is lost during conversions.
5902
 
    Result:='ISO-8859-1';
5903
 
  end;
5904
 
end;
5905
 
 
5906
 
function ConvertEncoding(const s, FromEncoding, ToEncoding: string): string;
5907
 
var
5908
 
  AFrom, ATo, SysEnc : String;
5909
 
  Encoded : Boolean;
5910
 
  {$ifdef HasIconvEnc}
5911
 
  Dummy: String;
5912
 
  {$endif}
5913
 
begin
5914
 
  AFrom:=NormalizeEncoding(FromEncoding);
5915
 
  ATo:=NormalizeEncoding(ToEncoding);
5916
 
  SysEnc:=NormalizeEncoding(GetDefaultTextEncoding);
5917
 
  if AFrom=EncodingAnsi then AFrom:=SysEnc;
5918
 
  if ATo=EncodingAnsi then ATo:=SysEnc;
5919
 
  if AFrom=ATo then begin
5920
 
    Result:=s;
5921
 
    exit;
5922
 
  end;
5923
 
  //DebugLn(['ConvertEncoding ',AFrom,' ',ATo]);
5924
 
  
5925
 
  if (AFrom=EncodingUTF8) then begin
5926
 
    if ATo=EncodingUTF8BOM then begin Result:=UTF8ToUTF8BOM(s); exit; end;
5927
 
    if ATo='iso88591' then begin Result:=UTF8ToISO_8859_1(s); exit; end;
5928
 
    if ATo='iso88592' then begin Result:=UTF8ToISO_8859_2(s); exit; end;
5929
 
    if ATo='cp1250' then begin Result:=UTF8ToCP1250(s); exit; end;
5930
 
    if ATo='cp1251' then begin Result:=UTF8ToCP1251(s); exit; end;
5931
 
    if ATo='cp1252' then begin Result:=UTF8ToCP1252(s); exit; end;
5932
 
    if ATo='cp1253' then begin Result:=UTF8ToCP1253(s); exit; end;
5933
 
    if ATo='cp1254' then begin Result:=UTF8ToCP1254(s); exit; end;
5934
 
    if ATo='cp1255' then begin Result:=UTF8ToCP1255(s); exit; end;
5935
 
    if ATo='cp1256' then begin Result:=UTF8ToCP1256(s); exit; end;
5936
 
    if ATo='cp1257' then begin Result:=UTF8ToCP1257(s); exit; end;
5937
 
    if ATo='cp1258' then begin Result:=UTF8ToCP1258(s); exit; end;
5938
 
    if ATo='cp437' then begin  Result:=UTF8ToCP437(s);  exit; end;
5939
 
    if ATo='cp850' then begin  Result:=UTF8ToCP850(s);  exit; end;
5940
 
    if ATo='cp866' then begin  Result:=UTF8ToCP866(s);  exit; end;
5941
 
    if ATo='cp874' then begin  Result:=UTF8ToCP874(s);  exit; end;
5942
 
    if ATo = 'cp936' then
5943
 
    begin
5944
 
      Result := UTF8ToCP936(s);
5945
 
      exit;
5946
 
    end;
5947
 
    if ATo = 'cp950' then
5948
 
    begin
5949
 
      Result := UTF8ToCP950(s);
5950
 
      exit;
5951
 
    end;
5952
 
    if ATo = 'cp949' then
5953
 
    begin
5954
 
      Result := UTF8ToCP949(s);
5955
 
      exit;
5956
 
    end;
5957
 
    if ATo = 'cp932' then
5958
 
    begin
5959
 
      Result := UTF8ToCP932(s);
5960
 
      exit;
5961
 
    end;
5962
 
    if ATo='koi8' then begin  Result:=UTF8ToKOI8(s);  exit; end;
5963
 
    if ATo=EncodingUCS2LE then begin Result:=UTF8ToUCS2LE(s); exit; end;
5964
 
    if ATo=EncodingUCS2BE then begin Result:=UTF8ToUCS2BE(s); exit; end;
5965
 
 
5966
 
    if (ATo=SysEnc) and Assigned(ConvertUTF8ToAnsi) then begin
5967
 
      Result:=ConvertUTF8ToAnsi(s);
5968
 
      exit;
5969
 
    end;
5970
 
  end else if ATo=EncodingUTF8 then begin
5971
 
    if AFrom=EncodingUTF8BOM then begin Result:=UTF8BOMToUTF8(s); exit; end;
5972
 
    if AFrom='iso88591' then begin Result:=ISO_8859_1ToUTF8(s); exit; end;
5973
 
    if AFrom='iso88592' then begin Result:=ISO_8859_2ToUTF8(s); exit; end;
5974
 
    if AFrom='cp1250' then begin Result:=CP1250ToUTF8(s); exit; end;
5975
 
    if AFrom='cp1251' then begin Result:=CP1251ToUTF8(s); exit; end;
5976
 
    if AFrom='cp1252' then begin Result:=CP1252ToUTF8(s); exit; end;
5977
 
    if AFrom='cp1253' then begin Result:=CP1253ToUTF8(s); exit; end;
5978
 
    if AFrom='cp1254' then begin Result:=CP1254ToUTF8(s); exit; end;
5979
 
    if AFrom='cp1255' then begin Result:=CP1255ToUTF8(s); exit; end;
5980
 
    if AFrom='cp1256' then begin Result:=CP1256ToUTF8(s); exit; end;
5981
 
    if AFrom='cp1257' then begin Result:=CP1257ToUTF8(s); exit; end;
5982
 
    if AFrom='cp1258' then begin Result:=CP1258ToUTF8(s); exit; end;
5983
 
    if AFrom='cp437' then begin  Result:=CP437ToUTF8(s);  exit; end;
5984
 
    if AFrom='cp850' then begin  Result:=CP850ToUTF8(s);  exit; end;
5985
 
    if AFrom='cp866' then begin  Result:=CP866ToUTF8(s);  exit; end;
5986
 
    if AFrom='cp874' then begin  Result:=CP874ToUTF8(s);  exit; end;
5987
 
    if AFrom = 'cp936' then
5988
 
    begin
5989
 
      Result := CP936ToUTF8(s);
5990
 
      exit;
5991
 
    end;
5992
 
    if AFrom = 'cp950' then
5993
 
    begin
5994
 
      Result := CP950ToUTF8(s);
5995
 
      exit;
5996
 
    end;
5997
 
    if AFrom = 'cp949' then
5998
 
    begin
5999
 
      Result := CP949ToUTF8(s);
6000
 
      exit;
6001
 
    end;
6002
 
    if AFrom = 'cp932' then
6003
 
    begin
6004
 
      Result := CP932ToUTF8(s);
6005
 
      exit;
6006
 
    end;    
6007
 
    if AFrom='koi8' then begin  Result:=KOI8ToUTF8(s);  exit; end;
6008
 
    if AFrom=EncodingUCS2LE then begin Result:=UCS2LEToUTF8(s); exit; end;
6009
 
    if AFrom=EncodingUCS2BE then begin Result:=UCS2BEToUTF8(s); exit; end;
6010
 
 
6011
 
    if (AFrom=SysEnc) and Assigned(ConvertAnsiToUTF8) then begin
6012
 
      Result:=ConvertAnsiToUTF8(s);
6013
 
      exit;
6014
 
    end;
6015
 
  end
6016
 
  else begin
6017
 
    //ATo and AFrom <> EncodingUTF8. Need to do ANSI->UTF8->ANSI.
6018
 
    //TempStr := s;
6019
 
    Encoded := false;
6020
 
    
6021
 
    //ANSI->UTF8
6022
 
    if AFrom='iso88591' then begin
6023
 
      Result:=ISO_8859_1ToUTF8(s);
6024
 
      Encoded := true;
6025
 
    end
6026
 
    else if AFrom='iso88592' then begin
6027
 
      Result:=ISO_8859_2ToUTF8(s);
6028
 
      Encoded := true;
6029
 
    end
6030
 
    else if AFrom='cp1250' then begin
6031
 
      Result:=CP1250ToUTF8(s);
6032
 
      Encoded := true;
6033
 
    end
6034
 
    else if AFrom='cp1251' then begin
6035
 
      Result:=CP1251ToUTF8(s);
6036
 
      Encoded := true;
6037
 
    end
6038
 
    else if AFrom='cp1252' then begin
6039
 
      Result:=CP1252ToUTF8(s);
6040
 
      Encoded := true;
6041
 
    end
6042
 
    else if AFrom='cp1253' then begin
6043
 
      Result:=CP1253ToUTF8(s);
6044
 
      Encoded := true;
6045
 
    end
6046
 
    else if AFrom='cp1254' then begin
6047
 
      Result:=CP1254ToUTF8(s);
6048
 
      Encoded := true;
6049
 
    end
6050
 
    else if AFrom='cp1255' then begin
6051
 
      Result:=CP1255ToUTF8(s);
6052
 
      Encoded := true;
6053
 
    end
6054
 
    else if AFrom='cp1256' then begin
6055
 
      Result:=CP1256ToUTF8(s);
6056
 
      Encoded := true;
6057
 
    end
6058
 
    else if AFrom='cp1257' then begin
6059
 
      Result:=CP1257ToUTF8(s);
6060
 
      Encoded := true;
6061
 
    end
6062
 
    else if AFrom='cp1258' then begin
6063
 
      Result:=CP1258ToUTF8(s);
6064
 
      Encoded := true;
6065
 
    end
6066
 
    else if AFrom='cp850' then begin
6067
 
      Result:=CP850ToUTF8(s);
6068
 
      Encoded := true;
6069
 
    end
6070
 
    else if AFrom='cp866' then begin
6071
 
      Result:=CP866ToUTF8(s);
6072
 
      Encoded := true;
6073
 
    end
6074
 
    else if AFrom='cp874' then begin
6075
 
      Result:=CP874ToUTF8(s);
6076
 
      Encoded := true;
6077
 
    end
6078
 
    else if AFrom = 'cp936' then
6079
 
    begin
6080
 
      Result  := CP936ToUTF8(s);
6081
 
      Encoded := True;
6082
 
    end
6083
 
    else if AFrom = 'cp950' then
6084
 
    begin
6085
 
      Result  := CP950ToUTF8(s);
6086
 
      Encoded := True;
6087
 
    end
6088
 
    else if AFrom = 'cp949' then
6089
 
    begin
6090
 
      Result  := CP949ToUTF8(s);
6091
 
      Encoded := True;
6092
 
    end
6093
 
    else if AFrom = 'cp932' then
6094
 
    begin
6095
 
      Result  := CP932ToUTF8(s);
6096
 
      Encoded := True;
6097
 
    end    
6098
 
    else if AFrom='koi8' then begin
6099
 
      Result:=KOI8ToUTF8(s);
6100
 
      Encoded := true;
6101
 
    end
6102
 
    else if (AFrom=SysEnc) and Assigned(ConvertAnsiToUTF8) then begin
6103
 
      Result:=ConvertAnsiToUTF8(s);
6104
 
      Encoded := true;
6105
 
    end;
6106
 
    
6107
 
    if Encoded = true then begin
6108
 
      //UTF8->ANSI
6109
 
      Encoded := false;
6110
 
      if ATo='iso88591' then begin
6111
 
        Result:=UTF8ToISO_8859_1(Result);
6112
 
        Encoded := true;
6113
 
      end
6114
 
      else if ATo='iso88592' then begin
6115
 
        Result:=UTF8ToISO_8859_2(Result);
6116
 
        Encoded := true;
6117
 
      end
6118
 
      else if ATo='cp1250' then begin
6119
 
        Result:=UTF8ToCP1250(Result);
6120
 
        Encoded := true;
6121
 
      end
6122
 
      else if ATo='cp1251' then begin
6123
 
        Result:=UTF8ToCP1251(Result);
6124
 
        Encoded := true;
6125
 
      end
6126
 
      else if ATo='cp1252' then begin
6127
 
        Result:=UTF8ToCP1252(Result);
6128
 
        Encoded := true;
6129
 
      end
6130
 
      else if ATo='cp1253' then begin
6131
 
        Result:=UTF8ToCP1253(Result);
6132
 
        Encoded := true;
6133
 
      end
6134
 
      else if ATo='cp1254' then begin
6135
 
        Result:=UTF8ToCP1254(Result);
6136
 
        Encoded := true;
6137
 
      end
6138
 
      else if ATo='cp1255' then begin
6139
 
        Result:=UTF8ToCP1255(Result);
6140
 
        Encoded := true;
6141
 
      end
6142
 
      else if ATo='cp1256' then begin
6143
 
        Result:=UTF8ToCP1256(Result);
6144
 
        Encoded := true;
6145
 
      end
6146
 
      else if ATo='cp1257' then begin
6147
 
        Result:=UTF8ToCP1257(Result);
6148
 
        Encoded := true;
6149
 
      end
6150
 
      else if ATo='cp1258' then begin
6151
 
        Result:=UTF8ToCP1258(Result);
6152
 
        Encoded := true;
6153
 
      end
6154
 
      else if ATo='cp850' then begin
6155
 
        Result:=UTF8ToCP850(Result);
6156
 
        Encoded := true;
6157
 
      end
6158
 
      else if ATo='cp866' then begin
6159
 
        Result:=UTF8ToCP866(Result);
6160
 
        Encoded := true;
6161
 
      end
6162
 
      else if ATo='cp874' then begin
6163
 
        Result:=UTF8ToCP874(Result);
6164
 
        Encoded := true;
6165
 
      end
6166
 
      else if ATo = 'cp936' then
6167
 
      begin
6168
 
        Result  := UTF8ToCP936(Result);
6169
 
        Encoded := True;
6170
 
      end
6171
 
      else if ATo = 'cp950' then
6172
 
      begin
6173
 
        Result  := UTF8ToCP950(Result);
6174
 
        Encoded := True;
6175
 
      end
6176
 
      else if ATo = 'cp949' then
6177
 
      begin
6178
 
        Result  := UTF8ToCP949(Result);
6179
 
        Encoded := True;
6180
 
      end
6181
 
      else if ATo = 'cp932' then
6182
 
      begin
6183
 
        Result  := UTF8ToCP932(Result);
6184
 
        Encoded := True;
6185
 
      end      
6186
 
      else if ATo='koi8' then begin
6187
 
        Result:=UTF8ToKOI8(Result);
6188
 
        Encoded := true;
6189
 
      end
6190
 
      else if (ATo=SysEnc) and Assigned(ConvertUTF8ToAnsi) then begin
6191
 
        Result:=ConvertUTF8ToAnsi(Result);
6192
 
        Encoded := true;
6193
 
      end;
6194
 
    end;
6195
 
    
6196
 
    //Exit if encoded succesfully.
6197
 
    if Encoded = true then begin
6198
 
      exit;
6199
 
    end;
6200
 
    
6201
 
  end;
6202
 
 
6203
 
  Result:=s;
6204
 
  {$ifdef HasIconvEnc}
6205
 
  try
6206
 
    if not IconvLibFound and not InitIconv(Dummy) then
6207
 
    begin
6208
 
      {$IFNDEF DisableChecks}
6209
 
      DebugLn(['Can not init iconv: ',Dummy]);
6210
 
      {$ENDIF}
6211
 
      Exit;
6212
 
    end;
6213
 
    if Iconvert(s, Result, AFrom, ATo)<>0 then
6214
 
    begin
6215
 
      Result:=s;
6216
 
      Exit;
6217
 
    end;
6218
 
  except
6219
 
  end;
6220
 
  {$endif}
6221
 
end;
6222
 
 
6223
 
end.