Revision 4 of 4, by WikiArchive on 11-10-2026. The page as it is now.
$codePage
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).
use
Since FPC 3.0.0 every ANSIString is associated with a CP.
see also
From the Free Pascal wiki, page "$codePage", as it stood on 2023-11-11 after a change by Bart, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.
