[fpc-devel] Explanation about code page-aware AnsiStrings
Hans-Peter Diettrich
DrDiettrich1 at aol.com
Wed Jan 8 14:24:12 CET 2014
Jonas Maebe schrieb:
> http://wiki.freepascal.org/FPC_Unicode_support (only Sections 1 to 3; 4
> and later are older and mostly either incomplete or wishful thinking).
Just a note on RawByteString concatenation:
Delphi concatenates RawByteStrings to the dynamic encoding of the
*first* string, the appended strings eventually are converted before
concatenation. Special handling of strings with the same encoding is not
required.
I.e. the result is *not* always a CP_ACP string, as documented in the wiki.
Please adjust the implementation accordingly, it makes the
RawByteStrings much more useful. The handling of automatic conversions
may be unified in general, when concatenated strings are assigned to a
target of a known encoding; in this case the target encoding can be used
for the result, instead of the encoding of the first string, the
remaining concatenation process can be the same.
On OEMString:
CP_OEM (=1) works differently from CP_ACP (=0). Variables of type
AnsiString(CP_OEM) will always have dynamic encoding CP_OEM, no
substitution to a specific OEM codepage. CP_ACP strings instead have a
dynamic encoding of the current DefaultSystemCodepage.
DoDi
More information about the fpc-devel
mailing list