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

Marcos Douglas md at delfire.net
Sun Dec 15 04:02:17 CET 2013


Hi,

I'm using Lazarus (trunk) and FPC 2.6.2 to programming on Windows (XP, 7 and 8).
As everyone knows, Lazarus is UTF8 but FPC 2.6.2 is ANSI.

I would like to know how do you working (on Windows) when uses Lazarus.

How I work:
1. I use [string] to represent any type string. But some libs (DLL,
ActiveX, etc) uses WideString;
2. If I have to create a file, I use UTF8ToSys(FileName)... and if I
have a TStringList I use SS.Text := UTF8ToSys(Text)... and at the end
SS.SaveToFile(UTF8ToSys(FileName));

I don't know about you think, but this is VERY frustating. If you
forget only one call to UTF8ToSys... errors can happen, and the same
to SysToUTF8.

So, I searched for a good solution but the Wiki stay the same:
http://wiki.freepascal.org/LCL_Unicode_Support#Dealing_with_directory_and_filenames

...use SysToUTF8, UTF8ToSys.

Then I searched in Lazarus' sources and -- as you can see in image
attachment -- Lazarus uses the same "technique".


I know the FPC team are working in a version of FPC Unicode but I
don't know when it will be available -- and if the problem will
persist.

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?


Marcos Douglas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: screenshot.PNG
Type: image/png
Size: 46757 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20131215/f73a44d3/attachment-0002.png>


More information about the Lazarus mailing list