Daniël Mantione wrote:
>
> Op Mon, 7 May 2007, schreef Christos Chryssochoidis:
>
>> Hi,
>>
>> Are there any rtl functions to compute the length (in characters) of a
>> widestring and to iterate over its characters?
>
> If you treat it as UCS-2: length(widestring_variable)
>
>> In my system (Mac OS X/fpc 2.1.3), a widestring is implemented as a UTF-8
>> encoded string, as I found out.
>
> Not possible, a widestring is UCS-2/UTF-16.

I defined a widestring with 7 characters (code points), and the length() function returned the value 15. Of the 7 code points of that widestring only one of them was greater than $07FF (the maximum code point which can be encoded in 2 bytes under UTF-8). When I changed that character with another one with code not greater than $07FF, length() returned value 14... I also printed the byte values of one of the widestring's widechars, and the values printed indicated UTF-8 encoding.

Thanks,
Christos


>
> Daniël
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> fpc-pascal maillist - [EMAIL PROTECTED]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal



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

Reply via email to