Ini files in wrong directory (because of Polish letter?)
Moderators: Hacker, petermad, Stefan2, white
-
- Senior Member
- Posts: 284
- Joined: 2011-09-23, 10:35 UTC
Re: Ini files in wrong directory (because of Polish letter?)
Hello,
I tested now (Win10+TC9.22a)
I created windows .lnk file with Polish & Russian characters & both fail:
C:\Users\Paweł\TotalCMD\TOTALCMD.EXE -i="c:\Users\Paweł\TotalCMD\wincmd.ini" -f="c:\Users\Paweł\TotalCMD\wcx_ftp.ini"
C:\Users\Павел\TotalCMD\TOTALCMD.EXE -i="c:\Users\Павел\TotalCMD\wincmd.ini" -f="c:\Users\Павел\TotalCMD\wcx_ftp.ini"
from command line same, TCM reports in "About":
c:\Users\Pawel\TotalCMD\wincmd.ini
c:\Users\Pawel\TotalCMD\wcx_ftp.ini
&
c:\Users\?????\TotalCMD\wincmd.ini
c:\Users\?????\TotalCMD\wcx_ftp.ini
if you have info in the registry: IniFileName it's exactly the same, & what is interesting if you have registry info & you run tc951rc4 installation you will get also error during installation: "Could not create ini file dir! The ini file location will not be saved" even if the is already folder...
but
"c:\Program Files (x86)\TotalCMD\TOTALCMD.EXE" -i="c:\Program Files (x86)\TotalCMD\wincmd.ini" -f="c:\Program Files (x86)\TotalCMD\wcx_ftp.ini"
works fine
I tested now (Win10+TC9.22a)
I created windows .lnk file with Polish & Russian characters & both fail:
C:\Users\Paweł\TotalCMD\TOTALCMD.EXE -i="c:\Users\Paweł\TotalCMD\wincmd.ini" -f="c:\Users\Paweł\TotalCMD\wcx_ftp.ini"
C:\Users\Павел\TotalCMD\TOTALCMD.EXE -i="c:\Users\Павел\TotalCMD\wincmd.ini" -f="c:\Users\Павел\TotalCMD\wcx_ftp.ini"
from command line same, TCM reports in "About":
c:\Users\Pawel\TotalCMD\wincmd.ini
c:\Users\Pawel\TotalCMD\wcx_ftp.ini
&
c:\Users\?????\TotalCMD\wincmd.ini
c:\Users\?????\TotalCMD\wcx_ftp.ini
if you have info in the registry: IniFileName it's exactly the same, & what is interesting if you have registry info & you run tc951rc4 installation you will get also error during installation: "Could not create ini file dir! The ini file location will not be saved" even if the is already folder...
but
"c:\Program Files (x86)\TotalCMD\TOTALCMD.EXE" -i="c:\Program Files (x86)\TotalCMD\wincmd.ini" -f="c:\Program Files (x86)\TotalCMD\wcx_ftp.ini"
works fine
Re: Ini files in wrong directory (because of Polish letter?)
I created new account "Pawełek", because "Paweł" and "pawel" is the same after convert ł to latin l.ghisler(Author) wrote: 2020-03-06, 16:37 UTC So only the installer fails to run from a subdir of C:\Users\Paweł, but Total Commander then runs fine when the settings are under C:\Users\Paweł?
1. Installation failed to start from location: c:\Users\Pawełek\Downloads\tcmd950x64.exe.
2. Installation completed from c:\Users\Public\Desktop\tcmd950x64.exe, but error "Could not create program group!" and user home directory recognized as c:\Users\Pawelek\
3. After installation, Total Commander start as regular user failed to save settings to file:
Error: Cannot write
C:\Users\Pawelek\AppData\Roaming\GHISLER\wincmd.ini!
Please remove this write protection!
4. Total Commander started as admin saved settings to c:\Users\Pawelek\AppData\Roaming\GHISLER\wincmd.ini.
5. regedit: IniFileName=%APPDATA%\GHISLER\wincmd.ini
6. cmd console:
C:\Users\Pawełek>echo %appdata%
C:\Users\Pawełek\AppData\Roaming
Re: Ini files in wrong directory (because of Polish letter?)
Did you consider using GetShortPathName function?ghisler(Author) wrote: 2020-02-26, 09:47 UTC This only works when setting the user locale to Poland for non-Unicode programs. Otherwise the ł isn't part of the codepage and cannot be used in ANSI INI file functions. This cannot be fixed on my side.
- ghisler(Author)
- Site Admin
- Posts: 50386
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: Ini files in wrong directory (because of Polish letter?)
I just tried creating such a link file myself - here the about box reports the correct name with the ł. When I check it in the debugger, I get the path as UTF-8.I created windows .lnk file with Polish & Russian characters & both fail:
C:\Users\Paweł\TotalCMD\TOTALCMD.EXE -i="c:\Users\Paweł\TotalCMD\wincmd.ini" -f="c:\Users\Paweł\TotalCMD\wcx_ftp.ini"
C:\Users\Павел\TotalCMD\TOTALCMD.EXE -i="c:\Users\Павел\TotalCMD\wincmd.ini" -f="c:\Users\Павел\TotalCMD\wcx_ftp.ini"
from command line same, TCM reports in "About":
c:\Users\Pawel\TotalCMD\wincmd.ini
c:\Users\Pawel\TotalCMD\wcx_ftp.ini
How did you launch the download? I tried various ways:1. Installation failed to start from location: c:\Users\Pawełek\Downloads\tcmd950x64.exe.
1. Downlaoded from Edge, started installer from it -> works
2. Downlaoded from Chrome, started installer from it -> works
3. Downlaoded from Firefox, started installer from it -> works
4. Started any of these downloads from Windows Explorer -> works
Also the program runs just fine afterwards.
There is no need, the short name passed to TC by Windows is already in UTF-8. For some unknown reasons, this doesn't work for user krasusczak.Did you consider using GetShortPathName function?
2krasusczak.
Maybe it's a bug in older Windows 10 versions? Can you tell me which one you use? I use the latest release version 1903.
You can check that via menu
Commands - System information - Software - ProductId.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
-
- Senior Member
- Posts: 284
- Joined: 2011-09-23, 10:35 UTC
Re: Ini files in wrong directory (because of Polish letter?)
I have newest one 1903ghisler(Author) wrote: 2020-03-09, 11:31 UTC
2krasusczak.
Maybe it's a bug in older Windows 10 versions? Can you tell me which one you use? I use the latest release version 1903.
You can check that via menu
Commands - System information - Software - ProductId.
Re: Ini files in wrong directory (because of Polish letter?)
Is that correct about UTF-8? Windows internally and in W-suffixed functions uses UTF-16 LE, while A-suffiexed funcitons use ANSI/OEM.ghisler(Author) wrote: 2020-03-09, 11:31 UTCThere is no need, the short name passed to TC by Windows is already in UTF-8. For some unknown reasons, this doesn't work for user krasusczak.Did you consider using GetShortPathName function?
Generated short names should be ASCII-only, and it could be checked with dir /x.
An alternative to GetShortPathName might be be PathGetShortPath function.
By the way, the latest Windows 10 is 1909 (18363).
Re: Ini files in wrong directory (because of Polish letter?)
Is it correct to rely on short names in 2020 when modern systems allow disabling them completely? I still think that most reliable way is using W-functions with UTF-16 paths.
- ghisler(Author)
- Site Admin
- Posts: 50386
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: Ini files in wrong directory (because of Polish letter?)
Sorry, it's indeed 1909 here. I will test with 1903.
Yes, when the above mentioned UTF-8 option is set, then the codepage for ANSI and OEM are both set to 65001, which is UTF-8. All conversions from ANSI to Unicode and vice versa will convert UTF-16 from/to UTF-8.Is that correct about UTF-8? Windows internally and in W-suffixed functions uses UTF-16 LE, while A-suffiexed funcitons use ANSI/OEM.
There is no warning from Microsoft that these functions are deprecated. The A and W functions are equally well suited.Is it correct to rely on short names in 2020 when modern systems allow disabling them completely?
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Re: Ini files in wrong directory (because of Polish letter?)
According to this discussion UTF-8 and Win32 ANSI APIs, system code page should be set to 65001 (UTF-8).ghisler(Author) wrote: 2020-03-10, 07:22 UTC All conversions from ANSI to Unicode and vice versa will convert UTF-16 from/to UTF-8.
I am losing perspective, how this might help with Windows 95 compatibility.

Re: Ini files in wrong directory (because of Polish letter?)
It's not about the API functions. Short names may be disabled on all NTFS volumes: https://support.microsoft.com/en-us/help/121007/how-to-disable-8-3-file-name-creation-on-ntfs-partitionsghisler(Author) wrote: 2020-03-10, 07:22 UTCSorry, it's indeed 1909 here. I will test with 1903.There is no warning from Microsoft that these functions are deprecated.
As the article describes, this can also be done on a per-volume basis, i.e. short names may be enabled on one volume but not on others.
Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Re: Ini files in wrong directory (because of Polish letter?)
I can confirm on Windows 7 32-bit TC started like:
%commander_exe% /I=c:\totalcmd\test\Paweł\test.ini
will create a new c:\totalcmd\test\Pawel\ dir with ini file inthere which TC will use.
The short name of "Paweł" dir doesn't have "ł" character as part of name (it's "pawe~1" here).
Short DOS names of course won't work on drives or file systems where 8.3 names disabled or not available, but at least this way TC could support more systems. There are some other situations (example) where using 8.3 names could solve the problems caused by some characters present in long file names.
%commander_exe% /I=c:\totalcmd\test\Paweł\test.ini
will create a new c:\totalcmd\test\Pawel\ dir with ini file inthere which TC will use.
The short name of "Paweł" dir doesn't have "ł" character as part of name (it's "pawe~1" here).
Short DOS names of course won't work on drives or file systems where 8.3 names disabled or not available, but at least this way TC could support more systems. There are some other situations (example) where using 8.3 names could solve the problems caused by some characters present in long file names.
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
Ukraine's National Bank special bank account:
UA843000010000000047330992708
- ghisler(Author)
- Site Admin
- Posts: 50386
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: Ini files in wrong directory (because of Polish letter?)
OK, I have put quite a lot of work into this problem in RC5. The following should work now:
1. The installer can now work from a Unicode directory, even if it doesn't have an 8.3 name.
2. When 8.3 name creation is enabled, TC will use the 8.3 name of the user profile
3. If 8.3 names are disabled, the user will be informed that the ini location couldn't be used. I recommend using a local directory like c:\totalcmd in such a case.
What doesn't work:
1. TC must not be installed in a Unicode only directory.
2. INI files in a Unicode only directory will not work when 8.3 names are disabled. While I could use the Unicode INI functions, the same path is also used by many plugins, including many of my own. They currently all use ANSI functions. They will receive the 8.3 name too, so it should work in that case.
1. The installer can now work from a Unicode directory, even if it doesn't have an 8.3 name.
2. When 8.3 name creation is enabled, TC will use the 8.3 name of the user profile
3. If 8.3 names are disabled, the user will be informed that the ini location couldn't be used. I recommend using a local directory like c:\totalcmd in such a case.
What doesn't work:
1. TC must not be installed in a Unicode only directory.
2. INI files in a Unicode only directory will not work when 8.3 names are disabled. While I could use the Unicode INI functions, the same path is also used by many plugins, including many of my own. They currently all use ANSI functions. They will receive the 8.3 name too, so it should work in that case.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Re: Ini files in wrong directory (because of Polish letter?)
In my brief test TC 9.51 RC5 uses path with 8.3 names when started as:
%commander_exe% /I=c:\totalcmd\test\Paweł\test.ini
Also as I see, TC doesn't use 8.3 name for ini file itself if it has a long name with characters from a different codepage, so it seems ANSI only names are allowed for ini files. Is this intentional?
%commander_exe% /I=c:\totalcmd\test\Paweł\test.ini
The history.txt mentions c:\temp, so what one is really recommended? Is it safe to recommend one with "temp" as a name for storing ini files (it may be used for storing really temporarily files like *.tmp, and set on some cleanup task)?ghisler(Author) wrote: 2020-03-11, 18:26 UTC3. If 8.3 names are disabled, the user will be informed that the ini location couldn't be used. I recommend using a local directory like c:\totalcmd in such a case.
Does here "Unicode only" mean a Unicode long name without 8.3 short name alias, or any directory name with characters from a codepage different to system one? What will not work if to put TC files in such directory manually?ghisler(Author) wrote: 2020-03-11, 18:26 UTC1. TC must not be installed in a Unicode only directory.
Also as I see, TC doesn't use 8.3 name for ini file itself if it has a long name with characters from a different codepage, so it seems ANSI only names are allowed for ini files. Is this intentional?
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
Ukraine's National Bank special bank account:
UA843000010000000047330992708
- ghisler(Author)
- Site Admin
- Posts: 50386
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: Ini files in wrong directory (because of Polish letter?)
This is an error in history.txt.The history.txt mentions c:\temp
It means any directory name with characters from a codepage different to system one. Many functions to access internal TC files still use ANSI. It would take months to rewrite them all.Does here "Unicode only" mean a Unicode long name without 8.3 short name alias, or any directory name with characters from a codepage different to system one?
Indeed INI files cannot have Unicode names because the functions to read from ANSI INI files expects an ANSI name for the ini file too.Also as I see, TC doesn't use 8.3 name for ini file itself if it has a long name with characters from a different codepage, so it seems ANSI only names are allowed for ini files. Is this intentional?
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Re: Ini files in wrong directory (because of Polish letter?)
If TC dir, or the ini files have 8.3 short aliases, could the ANSI functions access TC dir and ini files by their 8.3 names? Or such functions need the rewriting for adding this Unicode name->8.3 name fallback?ghisler(Author) wrote: 2020-03-12, 10:20 UTCIt means any directory name with characters from a codepage different to system one. Many functions to access internal TC files still use ANSI. It would take months to rewrite them all.Does here "Unicode only" mean a Unicode long name without 8.3 short name alias, or any directory name with characters from a codepage different to system one?
Indeed INI files cannot have Unicode names because the functions to read from ANSI INI files expects an ANSI name for the ini file too.Also as I see, TC doesn't use 8.3 name for ini file itself if it has a long name with characters from a different codepage, so it seems ANSI only names are allowed for ini files. Is this intentional?
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
Ukraine's National Bank special bank account:
UA843000010000000047330992708