[fpc-pascal] UnicodeString and surrogate pairs

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Fri Apr 29 11:09:13 CEST 2016


On 2016-04-28 09:05, Michael Schnell wrote:
> Would that necessarily be an UTF-8 issue  ?

No, because UTF-8 doesn't use surrogate pairs. In this instance the
string is of type UnicodeString, thus UTF-16 encoded. Now I could
internally assign that to a UTF8String type, but in this case I wanted
to use UnicodeString directly with standard RTL or FCL functions.

On a side note:
  I always use UTF-8 encoded strings with fpGUI and my personal
  projects, because I simply find it easier and more stable (by
  default supporting the whole 1.1 million available Unicode code
  points). The code I'm currently working on is for a client, so I
  didn't enforce my coding habits. ;-)

Regards,
  Graeme

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

My public PGP key:  http://tinyurl.com/graeme-pgp



More information about the fpc-pascal mailing list