[fpc-pascal] Unicode characters in source code

Mattias Gärtner nc-gaertnma at netcologne.de
Wed Apr 21 11:52:22 CEST 2010


Zitat von Tomas Hajny <XHajT03 at hajny.biz>:

> On Wed, April 21, 2010 10:47, ik wrote:
>
>
> Hi,
>
>>> If I want to use Unicode characters in my source code, but without
>>> actually
>>> typing in the Unicode character - I rather want to define it similar to
>>> ASCII chars or Hex values:
>>>  eg:  Char(65)    or   'test'+#65+'me'
>>>      or similar to what hex values are defined with a dollar prefix: $30
>>>
>>> Any idea how I can do this? I don't want to mess with the -Fcutf8
>>> compiler
>>> parameter if I can avoid it. I also want the ability of the source code

Caption:=#$C3#$A4; // a umlaut


>  .
>
> What do you mean by "messing with the -Fcutf8 parameter"? If you include
> some character constants outside the us-ascii set, you should always tell
> the compiler how to evaluate them, because the evaluation depends on the
> used encoding; especially if you intend to use those for Unicode specific
> types (characters or strings). The only alternative not requiring the
> compiler to evaluate the constants using certain encoding would be
> something like using the internally expected format and putting the values
> there directly as sequence of bytes using e.g. an absolute construct
> mapped to the same memory area, but that is probably neither efficient nor
> very wise considering necessity to rely on compiler internals...



Mattias






More information about the fpc-pascal mailing list