[fpc-devel] Unicode support (yet again)

Graeme Geldenhuys graemeg.lists at gmail.com
Thu Sep 15 11:15:22 CEST 2011


On 15/09/2011 10:59, Martin Schreiber wrote:
> 
> There are plenty of user problems with utf-8

Then they are not well versed in Unicode are they...


> character access

in fpGUI:
   UTF8Copy(...)
   UTF8CharAtByte(...)


> and string length.

in fpGUI:
  Length(...)   result is in bytes
  UTF8Length(...)  result is in "characters"


> I assume 100% of them would be solved with utf-16.

Unless they treat UTF-16 text as UCS-2 - forgetting about endianness and
surrogate pairs.


> And now there should be an even more complex string type implemented?

UTF-8 is not more complex at all. The good news is that if you write a
UTF-8 string handling routine, it works with ALL UTF-8 encoded strings,
from 1 byte to 4 byte code points. No special treatment or
considerations are required. Streaming is simple and easy as it is
already an array of bytes.  You can't get easier than that!


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/




More information about the fpc-devel mailing list