[fpc-devel] Unicode conversion routines

Florian Klaempfl florian at freepascal.org
Sat Nov 22 20:07:43 CET 2008


Graeme Geldenhuys schrieb:
> On Sat, Nov 22, 2008 at 10:51 AM, Florian Klaempfl
> <florian at freepascal.org> wrote:
>> function UTF8Decode(const s : UTF8String): UnicodeString;
> 
> Is there some hard-coded limit on UTF8Decode?  I am writing some unit
> tests for these methods and on my 3rd test, it already fails. I'm
> using testing sample data from unicode.org.

See http://bugs.freepascal.org/view.php?id=11791

> 
> var
>   s8: UTF8String;
>   s16: UnicodeString;
> begin
> 
>   // U+289A8 CJK UNIFIED IDEOGRAPH-289A8
>   s8 := Char($F0) + Char($A8) + Char($A6) + Char($A8);
>   s16 := UTF8Decode(s8);
> 
>   AssertEquals('Failed on 4', 4, Length(s16));
>   AssertEquals('Failed on 5', UnicodeChar($D862) + UnicodeChar($DDA8), s16)
> 
> end;
> 
> Test 4 fails: Expected 4 but was 0.
> Test 5 fails: to due to Test 4 failure...
> 
> 
> ---------------[  from unicode description file ]-----------------------
> U+289A8 CJK UNIFIED IDEOGRAPH-289A8
> 
> General Character Properties
> 
> Unicode category: Letter, Other
> 
> Various Useful Representations
> 
> UTF-8: 0xF0 0xA8 0xA6 0xA8
> UTF-16: 0xD862 0xDDA8
> ------------------------[ end ]----------------------------
> 
> 
> Regards,
>   - Graeme -
> 
> 
> _______________________________________________
> fpGUI - a cross-platform Free Pascal GUI toolkit
> http://opensoft.homeip.net/fpgui/
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
> 




More information about the fpc-devel mailing list