[Lazarus] String vs WideString

Marcos Douglas B. Santos md at delfire.net
Sun Aug 13 04:42:43 CEST 2017


On Sat, Aug 12, 2017 at 7:21 PM, Bo Berglund via Lazarus
<lazarus at lists.lazarus-ide.org> wrote:
> On Sat, 12 Aug 2017 17:56:58 -0300, "Marcos Douglas B. Santos via
> Lazarus" <lazarus at lists.lazarus-ide.org> wrote:
>
>>> Which one? Do you mean Windows CP-1252?
>>
>>Yes...
>>But would it make any difference?
>
> I recently had a problem with an application that was converted from
> old string type to AnsiString and seemingly worked in the new Unicode
> environment.
> However, we received reports that it had failed in some Asian
> countries (Korea, China, Thailand) and upon checking it turned out
> that the data inside a string used as buffer was changed because of
> locale differences....
>
> After switching out the affected variable declarations from AnsiString
> to RawByteString the application seemingly started to work again also
> on these locations.
>
> So AnsiString is not safe either....
>
> And after this I have spent some time to totally rework the use of
> strings as buffers to instead use TBytes. Lots of work but guaranteed
> to not sneak in unexpected conversions.

Is not simpler to use RawByteString instead TBytes?

Regards,
Marcos Douglas


More information about the Lazarus mailing list