Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2008-10

Might be a bug in lcl/lclproc.pas ConvertUTF8toUTF16()

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Brad Campbell

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?

Regards,
Brad

Dolphins are so intelligent that within a few weeks they can train Americans to stand at the edge of the pool and throw them fish.

Reply by email

Vincent Snijders
to Brad Campbell
Brad Campbell wrote 15 lines
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.

What Lazarus version do you use?
I cannot fin the line you mention. Maybe it has been fixed already in the SVN version.

Vincent

Reply by email

Brad Campbell
to Brad Campbell: I've been playing with this function, and it's choking on what I believe is a valid…
Brad Campbell wrote 16 lines
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.

Dolphins are so intelligent that within a few weeks they can train Americans to stand at the edge of the pool and throw them fish. -------------- next part -------------- A non-text attachment was scrubbed... Name: unicode.patch Type: text/x-diff Size: 616 bytes Desc: not available Url : http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20081004/f874ce96/attachment.bin

Reply by email

Tom Gregorovic
to Brad Campbell

2008/10/4 Brad Campbell :

Show quoted text 24 lines
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

Reply by email