Archive: "????" in APPDATA path for non unicode (hebrew) windows username


"????" in APPDATA path for non unicode (hebrew) windows username
  Hi everyone,
Installer doesn't want to work when windows username is in non-unicode language (specifically, Hebrew).

Assuming I can't use the unicode version of nsis compiler:

Environment: Windows XP, username is in Hebrew. In Regional settings I deliberately didn't set hebrew as the language for non-unicode applications.

Problem: In paths such as $APPDATA, NSIS replaces the user name with question marks.

Hint: The command line tool (command, not cmd) displays a short path with a number instead of the hebrew username (see image).

How can I get this number programmatically? Is there another solution to the question marks problem, without using unicode-nsis?

Thanks.


You can try...

4.9.3.9 GetFullPathName
[/SHORT] user_var(output) path_or_file
Assign to the user variable $x, the full path of the file specified. If the path portion of the parameter is not found, the error flag will be set and $x will be empty. If /SHORT is specified, the path is converted to the short filename form.

Nope. It fails for hebrew username. Succeeds for english username. :(


NSIS doesn't use Unicode and so it can only handle non-Unicode paths. You can use the Unicode version:

http://www.scratchpaper.com/


it's a great solution but i can't use it.


Originally posted by kichik
NSIS doesn't use Unicode and so it can only handle non-Unicode paths. You can use the Unicode version:

http://www.scratchpaper.com/

Maybe NSIS can put the short filename in the variable when the full one in Unicode?


That's what the API provides and once you get question marks, you can't safely convert it to a short name.


I coded a C/C++ solution last week and now calling it from my installer. This is the important part of the function:

// csidl is int value for some user folder.


>TCHAR path***91;256***93;;
>memset(path, 0, 256);
if (!
SHGetSpecialFolderPathW(NULL, path, csidl, FALSE)) return FALSE;

>TCHAR shortPath***91;256***93;;
>memset(shortPath, 0, 256);
if (!GetShortPathNameW(path, shortPath, 256)) return FALSE;

>char asciiShortPath***91;256***93;;
>memset(asciiShortPath, 0, 256);
>strcpy(asciiShortPath, ATL::CT2A(shortPath));
I could only make it work using the unicode version of SHGetSpecialFolderPath and GetShortPathName, and only then converting to ANSI.