#1 2024-08-19 13:56:59

sayencrusher
Member
Registered: 2024-07-31
Posts: 7

GetSystemPath has problem with Unicode address

I encountered an issue with `GetSystemPath` when dealing with Unicode paths. Specifically, the function returns an incorrect path for usernames containing Unicode characters. It seems that Lazarus's `GetAppConfigDir(False)` handles this correctly, likely because it uses `SHGetFolderPathW` (the wide-character version) instead of `SHGetFolderPath`, which mORMot relies on. This difference in API calls might cause incorrect path handling in mORMot.

Has anyone else faced this, and are there any known workarounds or fixes?

Offline

#2 2024-08-19 14:51:34

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,510
Website

Re: GetSystemPath has problem with Unicode address

This is indeed a Lazarus/FPC issue only, because Delphi uses either an UnicodeString or a pure AnsiString compatible with the API.
Lazarus forces the AnsiString codepage to the CP_UTF8, which fails indeed with this API.

I made a code review, and it seems to appear only twice in our code base:
https://github.com/synopse/mORMot2/commit/156e7abd
https://github.com/synopse/mORMot2/commit/98b32952

Thanks for the feedback!

Offline

Board footer

Powered by FluxBB