On 08/01/2014 17:17, Jonas Maebe wrote:
> 
> On 08 Jan 2014, at 15:58, Reinier Olislagers wrote:
> 
>> 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"
> 
> The codepage names used by the codepage directive are (unfortunately, I
> guess) unrelated to the code page numbers:
> http://www.freepascal.org/docs-html/prog/progsu88.html
> 
> They are the names of individual codepage units exposed by the charset
> unit, which have names such as cp866 and cp1251. In fact, in general I
> think you can just prefix the code page number with "cp" (other than for
> utf8, which is built into the compiler and can be accessed via utf8 or
> utf-8).
> 
> Note that this codepage functionality has been in FPC since 2.4.x
> already (or maybe 2.6.0). It's not new in any way.

Thanks a lot, Jonas.

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to