[Lazarus] String vs WideString

Bo Berglund bo.berglund at gmail.com
Sun Aug 13 00:21:55 CEST 2017


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.


-- 
Bo Berglund
Developer in Sweden



More information about the Lazarus mailing list