[fpc-devel] assign constant text to widestring

Michael Schnell mschnell at lumino.de
Thu Oct 23 13:16:52 CEST 2008


> The conversion
> utf-8<->utf-16 is a very expensive operation and the compiler has to
> insert it all over the place and people would cry about the performance
> of their programs.
Of course I do agree.

If you want to care about performance you need to know what to do: 
Either use WideString "all over the place" and beware of the LCL API, or 
use UTF8String  all over the place.

But if you use UTF8String you need to be aware that you can't do simple 
and totally normal things like s := copy(s, 3); to get the first three 
characters of a string. Really finding the first three characters of a 
string is an interesting and time consuming task with utf8 ;) .

That is why I feel that it would be a lot better if  the LCL would use a 
WideString API.

-Michael



More information about the fpc-devel mailing list