[fpc-pascal] UnicodeString and surrogate pairs

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Wed Apr 27 16:36:48 CEST 2016


Hi,

Does FPC's RTL (or FCL) include a function to check for UTF-16 surrogate
pairs? I'd be very surprised if there isn't, but I have yet to find it
in the documentation or source code I searched.

I need to process one "character" (loosely based on what you see on the
screen) at a time while calculating text width up to a maximum width. I
need to make sure I handle all Unicode text correctly, thus NOT just the
BMP of the Unicode standard, but all supplementary planes too. My
alternative is to convert the text from UTF-16 to UTF-8 and then process
it, but in this instance I'm hoping to stay with UTF-16 [never thought I
would ever say that out loudly! ;-)]

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