[fpc-devel] Encoded AnsiString
Hans-Peter Diettrich
DrDiettrich1 at aol.com
Mon Dec 30 01:12:25 CET 2013
Jonas Maebe schrieb:
> I'm inclined to add a global boolean variable to the system unit that
> allows changing this behaviour so that it uses CP_UTF8 instead in
> such cases (defaulting to false, for Delphi compatibility). In
> practice, setting it to true shouldn't cause problems even with
> virtually all Delphi, as routines that work with rawbytestring should
> be able to handle any code page anyway.
Sounds good, but I fear complications because such a global variable
will affect also library behaviour. When UTF-8 is used in Lazarus or for
filenames, and this encoding doesn't work in combination with string
literals (CP_ACP?), then the Delphi default is not acceptable. When
string literals are assumed as UTF-8, they won't work with strings of
CP_ACP or other encodings, for the same reason.
I'd restrict strict Delphi compatibility to string=UnicodeString, if
ever, and leave the UTF-8 RTL and LCL unaffected by the Delphi flaw. But
what's Delphi compatibility worth without a UTF-16 LCL?
DoDi
More information about the fpc-devel
mailing list