[fpc-pascal] Re: Widestrings length and character iteration
Christos Chryssochoidis
c.chryssochoidis at gmail.com
Wed May 9 13:48:10 CEST 2007
Daniël Mantione wrote:
>
> Op Wed, 9 May 2007, schreef Christos Chryssochoidis:
>
>> OK, I figured out what happened. The source file was saved in
UTF-8 encoding,
>> but I hadn't put in my source file the compiler directive
{$CODEPAGE UTF8}.
>> After including this directive in my code almost everything
worked fine:
>> length() was returning the right number of unicode characters, and
>> subscripting the widestring returned the right character. But as
the widechar
>> and widestring encoding is, as you said, UTF-16, while my Mac OS
X console
>> uses UTF-8 encoding, for the output results to be displayed
correctly I had to
>> wrap the individual widechars or the whole widestring with the
function
>> utf8encode(), prior to output them with write()...
>
> This means no widestring manager was used; the default dumb
widestring
> manager converts to iso-8859-1. Use the "cwstring" unit will use the
> system encoding when reading/writing widestrings.
>
> Daniël
>
>
>
------------------------------------------------------------------------
>
> _______________________________________________
> fpc-pascal maillist - fpc-pascal-PD4FTy7X32k2wBtHl531yWD2FQJk+8
+b at public.gmane.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
I called setCWideStringManager() from my code, but it did not had any
effect. A call to utf8encode() is still needed from proper output.
More information about the fpc-pascal
mailing list