[fpc-devel] Unicode proceedings

Marco van de Voort marcov at stack.nl
Thu Nov 17 15:01:43 CET 2011


In our previous episode, Sven Barth said:
> > Is there a general type dedicated for being able to hold any encoding ?
> > (be it ANSIxyz, UTF-8 or UTF-16) ?
> 
> In theory the AnsiString type (which is now the code page aware string 
> type) should be capable of holding UTF-8 and UTF-16 data, but either the 
> direct unconverted storage of 2 byte data (UTF-16) is forbidden or 
> undefined (don't remember which one it is in Delphi).

The ansistring and unicodestring types have the same memory layout except
for the character data (iow the record before the character data is the
same).

But that is not the same as ansistring allowing utf-16. Two types with the
same memory layout are not equivalent.
 
The purpose is probably because of rawbytestring, to combine certain runtime
procedures and helpers.



More information about the fpc-devel mailing list