[Lazarus] Lazarus (UTF8) and Windows: SysToUTF8, UTF8ToSys... Is there a better solution?

Sven Barth pascaldragon at googlemail.com
Thu Dec 26 17:02:25 CET 2013


Am 26.12.2013 12:30 schrieb "Hans-Peter Diettrich" <DrDiettrich1 at aol.com>:
>
> Sven Barth schrieb:
>>
>> Am 26.12.2013 02:19 schrieb "Hans-Peter Diettrich" <DrDiettrich1 at aol.com<mailto:
DrDiettrich1 at aol.com>>:
> Please specify "AnsiString", of which encoding?
>
> When I concat an AnsiString and an UTF8String and assign it to an
OEMString
>   o := a + u;
> then I get these warnings in XE:
>
> [DCC Warning] ConcTest.dpr(20): W1057 Implicit string cast from
'AnsiString' to 'string'
> [DCC Warning] ConcTest.dpr(20): W1057 Implicit string cast from
'UTF8String' to 'string'
> [DCC Warning] ConcTest.dpr(20): W1058 Implicit string cast with potential
data loss from 'string' to 'OEMString'
>
> I cannot see the system codepage used here.

Try to make o of type RawByteString. And maybe also use more than two
strings.

>
>
> What I want to point out are the string function overloads, where Delphi
supplies only string (UTF-16) and RawByteString arguments, and
AnsiString(CP_ACP) in unit AnsiStrings. FPC could add UTF8String overloads
and use these when dealing with AnsiStrings of an encoding different from
CP_ACP.

That was already discussed some time ago between devs and was deemed not
useable by Jonas. I'll try to find his mail with his explanation.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20131226/7fd44e9a/attachment-0003.html>


More information about the Lazarus mailing list