Am 2013-12-18 02:16, schrieb Marcos Douglas:
> On Tue, Dec 17, 2013 at 4:15 PM, Jürgen Hestermann
> <juergen.hesterm...@gmx.de> wrote:
>> I am just writing a file manager for Windows (hopefully can port it to Linux
>> later)
>> and I don't see any performance problems by using UTF8 in my program while
>> the API is UTF16.
>> Most (if not all) things that I do with files take much longer than the
>> string conversion so it does not matter much.
> Ok. But how do you work, using SysToUTF8 / UTF8ToSys?

I use the following:

---------------------------
var X,Path : UTF8String;
    FW     : Win32_Find_DataW;

H := FindFirstFileW(pwidechar(UTF8Decode(WinAPIPathName(Path))),FW);
...
X := UTF8Encode(UnicodeString(FW.cFileName));
---------------------------

where WinAPIPathName just prepends the "\\?\" string to the pathname to 
overcome the 255 char length limitation.
Path is the UTF8 string for the file search and X holds the found file name(s) 
in UTF8 notation.
When I later need an API-call I convert back:

---------------------------
... 
Windows.DeleteFileW(pwidechar(UTF8Decode(WinAPIPathName(AppendDir(Pfad,X)))))
---------------------------







--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to