From Free Pascal wiki
Jump to navigationJump to search

The global compiler directive {$codePage} indicates how to interpret string literals.

available code pages

The FPC can understand following code pages:

code page description
{$codePage CP437} Original IBM PC or DOS Latin US code page 437
{$codePage CP850} DOS Latin 1 code page 850
{$codePage CP852} DOS Latin 2 code page 852
{$codePage CP856} Hebrew, code page 856
{$codePage CP866} Cyrillic script, code page 866
{$codePage CP874} Thai, ISO/IEC 8859‑11
{$codePage CP1250} Windows‑1250
{$codePage CP1251} Cyrillic script, Windows‑1251
{$codePage CP1252} Windows‑1252
{$codePage CP1253} Greek script, Windows‑1253
{$codePage CP1254} Turkish, Windows‑1254
{$codePage CP1255} Hebrew, Windows‑1255
{$codePage CP1256} Arabic, Windows‑1256
{$codePage CP1257} Windows‑1257
{$codePage CP1258} Vietnamese, Windows-1258
{$codePage 8859-1} ISO Latin-1, ISO/IEC 8859‑1
{$codePage 8859-2} ISO/IEC 8859‑2
{$codePage 8859-5} Cyrillic script, ISO/IEC 8859‑5
{$codePage UTF-8}
{$codePage UTF8}
pseudo code page to switch back to UTF-8

The code page can be selected either via a compiler directive or as a command-line parameter: ‑Fc… (where  is one of the code page names listed above).


Since FPC 3.0.0 every ANSIString is associated with a CP.

see also