[fpc-devel] new string - question on usage

Paul Ishenin ip at kmiac.ru
Thu Oct 13 08:20:38 CEST 2011


13.10.2011 14:57, Hans-Peter Diettrich пишет:
> Paul Ishenin schrieb:
>> 13.10.2011 9:13, Hans-Peter Diettrich wrote:
>>> Sven Barth schrieb:
>>>
>>>> http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/rtl/inc/astrings.inc?revision=19444&view=markup
>>>>
>>>>
>>>
>>> I don't understand the use of encoding 0 and CP_NONE in FPC. Can
>>> somebody explain?
>>
>> DefaultSystemCodepage is used When the paticular encoding must be
>> known both for 0 and CP_NONE codepages.
>
> What's CP_NONE? Value and purpose?

RawByteString codepage. Value $FFFF and purpose - inform that string has 
no codepage assigned. I think at the moment compiler does not produce 
strings of codepage $FFFF anymore but before it did. So now we can 
probably clear the RTL from this codepage checks.

> It turned out that the result only is correct when at least one of the
> strings is an UnicodeString. Otherwise Pos seems to end up in a
> RawByteString compare, with the encoding ignored.

That's because if one UnicodeString type is present another Pos() works. 
In this case the second RawByteString argument converts into 
UnicodeString with taking encoding into account.

Old Pos() works without codepage conversions. This shows the test I gave 
and other tests.

Best regards,
Paul Ishenin.




More information about the fpc-devel mailing list