[fpc-devel] Trying to understand the wiki-Page "FPC Unicode support"
jonas.maebe at elis.ugent.be
Wed Nov 26 16:31:51 CET 2014
On 26/11/14 13:11, Michael Schnell wrote:
> In section "String concatenations" there is no mentioning about
> For statically typed Strings it's rather obvious that
> they will be auto-converted if appropriate.
It's probably rather obvious because it is literally mentioned in that
> Technically - if differently
> encode - they seem to be converted to Unicode and the result is
> converted to match the target.
Technically, that section literally states that they will be
concatenated without data loss and that the result is then converted to
the target string's encoding (except in case the target is
RawByteString). How that is implemented exactly is undefined; again in
the meaning of "undefined", not in the meaning of "undefined when
defined as meaning X".
> Regarding RawByteStrings there has been the definition "a RawByteString
> has exactly the same behavior as assigning that AnsiString(X) to another
> AnsiString(X) variable with the same value of X: no code page conversion
> or copying occurs". Seemingly this is not true for the intermediate
> results of concatenations.
That paragraph only specifies that code page-aware strings are
concatenated without data loss, and then defines to which code page the
result will be converted before assigning it to the target.
Even if the intermediary result of a concatenation would be a
RawByteString (which is not stated nor necessarily ever the case), then
the above would apply and hence the (dynamic) code page of that
RawByteString would be the one as defined by the above-mentioned rules
before it would be assigned to the target.
More information about the fpc-devel