[fpc-devel] Trying to understand the wiki-Page "FPC Unicode support"

Sven Barth pascaldragon at googlemail.com
Thu Nov 27 07:53:42 CET 2014


On 26.11.2014 19:54, Hans-Peter Diettrich wrote:
> UTF-16 is not a valid value for CP_ACP in Delphi, because it's a 2-byte
> encoding. Even if the Delphi architects may have thought about an common
> string type, with a variable element size (1,2,4), this certainly turned
> out soon as a stupid idea, so that AnsiString and
> WideString/UnicodeString still are strictly distinct types. WideString
> and UnicodeString imply UTF-16, with platform specific byte order
> (endianness). The latter becomes important almost only to compiler and
> library coders, in host/network byteorder conversions. For the sake of
> completeness, pdp-11 processors use yet another byte order, maybe more
> word-based processors (DG...) as well.

Just a little remark: please don't throw in WideString, which is a 
completely different type and only there for easy compatibility with COM 
and other Windows APIs. Unlike UnicodeString this type is not reference 
counted for example nor does it have the code page and element size 
information that a Ansi-/UnicodeString has.
(In FPC WideString is the same as UnicodeString for all non-Windows 
platforms)

Regards,
Sven



More information about the fpc-devel mailing list