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

Marcos Douglas md at delfire.net
Sun Dec 15 16:13:33 CET 2013


On Sun, Dec 15, 2013 at 2:01 AM, Hans-Peter Diettrich
<DrDiettrich1 at aol.com> wrote:
> Marcos Douglas schrieb:
>
>
>> How I work:
>> 1. I use [string] to represent any type string. But some libs (DLL,
>> ActiveX, etc) uses WideString;
>
>
> That's Windows specific, not portable.

Yes and this is not a problem.

>> 2. If I have to create a file, I use UTF8ToSys(FileName)...
>
>
> Okay for filenames, even if IMO it should not be necessary.

Not Ok for me. Because this I wrote this mail...
It is not necessary ONLY if you uses ANSI path names.

>> and if I
>> have a TStringList I use SS.Text := UTF8ToSys(Text)... and at the end
>> SS.SaveToFile(UTF8ToSys(FileName));
>
>
> Why that?

As Marco van de Voort said, SaveToFile is FPC.

>> I have many systems coded in FPC+Lazarus only to run on Windows so I ask
>> you:
>> Is there some trick to make the FPC+Lazarus to use only ANSI?
>
>
> Why that? Lazarus is using UTF-8 throughout, so that writing and reading
> files will work the same on all targets.

That is the problem! Lazarus write files in UTF-8 but I can't write my
(all) Windows files in UTF-8.


Marcos Douglas




More information about the Lazarus mailing list