[fpc-devel] assign constant text to widestring

Marco van de Voort marcov at stack.nl
Thu Oct 23 13:42:43 CEST 2008


In our previous episode, Florian Klaempfl said:
> > 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 ;) .
> 
> This is also a simplified view.
> - firstly, which real world (!) task really requires to execute an
> operation like this, mostly it's something like copy(s,pos(...),...);
> - secondly, a properly coded utf-16 application shouldn't do this
> either: it doesn't handle surrogates properly and e.g. umlauts can be
> encoded in all utf flavours as two "chars": base letter plus the umlaut
> (the two dots).

More importantly, most of such routines will be implicitely tied to a
certain language or language group already.

The idea that UCS2 simply expands the character range, and the rest stays
the same is naieve.



More information about the fpc-devel mailing list