[fpc-devel] Is calling the Windows Unicode APIs really faster than the ANSI API's?

Marco van de Voort marcov at stack.nl
Fri Sep 26 11:48:29 CEST 2008


In our previous episode, Martin Schreiber said:
> > Well if you have Utf-8 versions of all basic string processing
> > functions like Pos, Length, Copy, Insert etc you don't have to think
> > of encoding or anything. fpGUI uses UTF-8 internally, and I never have
> > to think about what encoding I'm working with. I assume Lazarus LCL is
> > the same.
> >
> It seems you prefer utf-8 over utf-16 for internal string encoding in a GUI 
> framework. Why?

> I prefer utf-16 over utf-8 for MSEide+MSEgui because *all* current users 
> (including the Chinese) can use simple string index to access the
> characters

See my previous discussion with Daniel. There is a CJK block over $FFFF
(afaik containing non-simplified Chinese). Moreover, with Vista there are no
special fonts or East Asia versions needed anymore to use these.

> of their used languages and almost nobody can use string index to access 
> characters in utf-8.

If you do it right, you can't with UTF-16 either. Moreover, you get a split
between the encoding used for GUI (utf-16, as forced by you), and a system
using UTF-8 on e.g. the free unices.

This was originally the reason for FPC to at least support both encodings,
UTF-8 users can for those few routines in their business code where they
must hack something character based together, simply declare those routines
with a forced UTF16 string type, and the system will autoconvert, without
the entire system having to be utf-16.



More information about the fpc-devel mailing list