[Lazarus] Windows API calls and german Umlauts

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Mar 9 14:16:02 CET 2016


On Wed, 9 Mar 2016 13:04:50 +0100
"John Landmesser" <JMLandmesser at gmx.de> wrote:

> Hi,
>  
> if i call a windows API function for special folder, like:
>  
> uses 
> ...
> shlobj;
>  
> var
>   AppDataPath: Array[0..MaxPathLen] of Char;
> begin
>   SHGetSpecialFolderPath(0,AppDataPath,CSIDL_STARTUP,false);
> end;
>  
> I get on a german localized Windows XP a path containing  "\Startmen├╝\", but the "├╝" is "?" in the resulting string.
>  
> Howto convert  the chars in AppDataPath to get the "Umlauts" correct?

According to msdn SHGetSpecialFolderPath is not supported by Microsoft.
Instead, use ShGetFolderPath.

Unit LazFileUtils has already a more sophisticated implementation
for UTF8. I added 
function SHGetFolderPathUTF8(ID :  Integer) : String;

Mattias




More information about the Lazarus mailing list