[fpc-pascal] 2.5.1: Ansi string constants vs Unicode

Jonas Maebe jonas.maebe at elis.ugent.be
Sat Jul 10 23:31:11 CEST 2010


On 10 Jul 2010, at 23:13, Martin wrote:

> It would be nice if there was(maybe there is) some way, of telling the compiler that the string is to be treaded as binary-data. Maybe like:
> 
> {$codepage utf8}
> const
> {$codepage binary} // temporary change
>  s1: shortstring = 'éà';
> {$codepage utf8} // back to original
> s2: ansistring = #$094#$06D;
> s3: ansistring = #267#543;

No, that is not possible. A file always has only one code page.

If you want the compiler not to interpret any of the character literals, you can do so by not using any {$codepage xxx} directive (and not including any BOM either). Then you can save the file in your editor using any code page you want, and the compiler will treat the characters as sequences of byte literals.


Jonas


More information about the fpc-pascal mailing list