[Lazarus] [PATCH] Re: Might be a bug in lcl/lclproc.pas ConvertUTF8toUTF16()

Tom Gregorovic _tom_ at centrum.cz
Sat Oct 4 14:46:39 CEST 2008


2008/10/4 Brad Campbell <brad at wasp.net.au>:
> Brad Campbell wrote:
>>
>> G'day all,
>>
>> I've been playing with this function, and it's choking on what I believe
>> is a valid unicode construct.
>>
>> UTF-8 encoding is $EF $82 $80
>> UTF-16 encoding is $F080.
>>
>> ConvertUTF8toUTF16 returns trInvalidChar
>>
>> Looking at the code, it does a compare
>>
>> Line : 3850 if W < $D800 then // to single wide char UTF-16 char
>>
>> ..however $F080 is a valid UTF-16 encoding.
>>
>> Do we have any Unicode experts in the house?
>
> Ok, so I dived into the Unicode documentation, and this patch should be
> valid. It certainly fixes my issue anyway.
>
>

It is certainly a bug. We wrongly assumed to refuse code points >
$DFFF and <= $FFFF.
This is fixed in SVN rev. 16868.

Thanks,
Tom Gregorovic



More information about the Lazarus mailing list