[fpc-devel] Default strings encoding

Daniël Mantione daniel.mantione at freepascal.org
Tue Oct 10 18:52:42 CEST 2006



Op Tue, 10 Oct 2006, schreef Felipe Monteiro de Carvalho:

> Hello,
> 
> If I have a ansistring, and cast that to a WideString, fpc is
> converting from which encoding to which encoding?

Without widestring manager, it converts iso-8859-1 to UCS-2.

> ansistring can hold utf-8 also, not only iso.

Yes, but in that case, declare it as UTF8string. There exist functions 
UTF8encode and UTF8decode to convert between an UTF8string and a 
widestring.

> I'm not sure what
> WideString holds. Maybe UTF-16? Or a limited UTF-16 with only 2 bytes
> characters.

UCS-2. Basically this is UTF-16 with only 2-byte characters, allthough 
there are small differences in the high regions; UCS-2 is code 
points $0..$ffff, while UTF-16 has facilities to allow for multiword 
characters.

Daniël


More information about the fpc-devel mailing list