[fpc-pascal] UTF-16 versions of Length, Pos, Delete etc.
Martin Schreiber
fpmse at bluewin.ch
Wed Jul 30 11:51:45 CEST 2008
On Wednesday 30 July 2008 09.04:02 Graeme Geldenhuys wrote:
> Hi,
>
> Has anybody already implemented the string utility functions like
> Length, Pos, Delete, Copy, Insert etc. that works with UTF-16. I'm not
> interested in UCS2 only support, I want full UTF-16 support.
>
> I'm willing to implement those, but why reinvent the wheel when
> somebody already did it before... :)
>
Use the normal FPC widestring routines. There is no difference between
handling of UCS2 or utf-16 except that ucs2string[<n>] always returns a
codepoint. Pos() works for UCS2 and utf-16.
If you must work with character cells of the whole Unicode range which are
addressed by an index, you should convert to an array of ucs4char before
processing.
Please note that a glyph often is composed by more than one codepoint.
Martin
More information about the fpc-pascal
mailing list