On 12.12.2015 17:37, Jürgen Hestermann wrote:
Is it correct that now every ansistring has a static code page and a dynamic code page (as mentioned in http://wiki.freepascal.org/FPC_Unicode_support)?
Yes.
Is it correct that each ansistring type can store strings with any encoding (dynamic code page) but there is a "genuine" (static) code page which is preferred (in cases a target encoding needs to be chosen)?
Yes.
What is the difference between UTF8String = type ansistring(cp_UTF8); and String = type ansistring(cp_ACP); when cp_ACP=cp_UTF8?
CP_ACP is *never* CP_UTF8. It is *always* CP_ACP. So these two will *always* be different types. However the specific codepage that CP_ACP refers to is determined at runtime and that can indeed be CP_UTF8.
Both would have the same static code page (UTF-8) but may contain a different encoding at run time. So why can't I use an UTF8String in the same way as a String type as parameter? Why are they not assignment compatible?
They are assignment compatible (all AnsiStrings are) and the compiler will insert a code page conversion if necessary (if CP_ACP refers to CP_UTF8 and if one of the two strings is CP_ACP the other CP_UTF8 then the conversion routine won't do a code page conversion of course). However since they are different types you can't simply pass a AnsiString(CP_UTF8) to a var parameter of type AnsiString(CP_ACP).
Regards, Sven -- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus