[fpc-pascal] UTF8 codepage for file in trunk: codepage constant names?

Reinier Olislagers reinierolislagers at gmail.com
Wed Jan 8 15:58:50 CET 2014


First, thanks to all involved in documenting the existing FPC trunk
Unicode situation on the wiki. Exactly the kind of docs I was looking for!

I'm trying to avoid ambiguity for an UTF8 (without BOM) encoded file and
tried this:
{$ifdef fpc}
  //Explicitly specify this is an UTF8 encoded file.
  //Alternative would be UTF8 with BOM but writing UTF8 BOM is bad practice.
  //See
http://wiki.lazarus.freepascal.org/FPC_Unicode_support#String_constants
  {$codepage 65001} //utf8
{$endif fpc}

However, I get
stringtests.pas(5,4) Error: Unknown codepage "65001"

Replacing the {$codepage 65001} with
{$codepage UTF8}
does seem to work.

http://wiki.lazarus.freepascal.org/FPC_Unicode_support#Code_page_identifiers
mentions identifiers follow the Windows numbers but obviously you have
to spell out UTF8 at least rather than specifying the number.
Is there a list of these constants somewhere?

Thanks,
Reinier



More information about the fpc-pascal mailing list