[fpc-devel] Controlling the output of the widestring manager

Daniël Mantione daniel.mantione at freepascal.org
Wed Dec 5 09:05:53 CET 2007


Op Tue, 4 Dec 2007, schreef Jonas Maebe:

> Marc Weustink wrote on di, 04 dec 2007:
> > Jonas Maebe wrote:
> > > 
> > > Are widestrings supposed to be UTF-16 or UCS-2 on unix? Currently
> > > they are UTF-16, but a lot of routines seem to assume UCS-2 (like
> > > the generic WideStringToUCS4String, and the unix
> > > Lower/UpperWideString)
> > 
> > It is a bit confusing, but for a while now UCS-2 uses UTF-16 as
> > encoding. So even UCS-2 is nowadays not fixed length.
> > 
> > I guess you mean the UCS-2 standard from the times that each char  was 2
> > bytes.
> Yes, I did. Thanks for the clarification, I'll fix everything to work with
> (variable length) UTF-16 then. Or does Windows still use fixed length UCS-2?

Before Windows 2000 Windows used fixed length, after Windows 2000 it was 
variable length.

> And if so, does this UCS-2 use the code points which are reserved for
> surrogate pairs in UTF-16?

No, the only difference between UCS-2 is that in the original UCS-2 the 
surrogate code points were reserved, while in UTF-16 they are used.


More information about the fpc-devel mailing list