tc756a: wincmd.ini in utf-8 problem with first line

Please report only one bug per message!

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
white
Power Member
Power Member
Posts: 4622
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

tc756a: wincmd.ini in utf-8 problem with first line

Post by *white »

I noticed my Total Commander was not working correctly. I found out it was because wincmd.ini was in utf-8 and Total Commander did not interpret the first line correctly.

Try this:
  • In a folder of your choice create a file called wincmd.ini with the following contents:

Code: Select all

[Configuration]
SeparateTree=1
  • Save the file in utf-8 format
  • Run Total Commander using command line option /I to use the wincmd.ini file created earlier
  • No separate tree is displayed
  • Close Total Commander
  • Open the wincmd.ini file created earlier
  • An extra [Configuration] section has been added
If you add an empty line at the beginning the problem does not occur.

Code: Select all

[Configuration]
SeparateTree=1
User avatar
sqa_wizard
Power Member
Power Member
Posts: 3864
Joined: 2003-02-06, 11:41 UTC
Location: Germany

Post by *sqa_wizard »

Sorry, I tried it but it works fine. [WinXP german]

Tried utf-8 with:
CRLF at the end of each line
Just one CRLF after first line

LF at the end of each line
Just one LF after first line

Separate tree was shown in each case.
#5767 Personal license
User avatar
sqa_wizard
Power Member
Power Member
Posts: 3864
Joined: 2003-02-06, 11:41 UTC
Location: Germany

Post by *sqa_wizard »

One more idea: Do you save a utf-8 file with BOM ?
#5767 Personal license
User avatar
sqa_wizard
Power Member
Power Member
Posts: 3864
Joined: 2003-02-06, 11:41 UTC
Location: Germany

Post by *sqa_wizard »

Well, I can reproduce it now, using a utf-8 formatted file with BOM.

The (hidden) BOM prefix at the first line seems to inhibit a detection of the section header.
#5767 Personal license
User avatar
white
Power Member
Power Member
Posts: 4622
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Post by *white »

sqa_wizard wrote:One more idea: Do you save a utf-8 file with BOM ?
Well, saving without BOM would result in the same file as when saving as ANSI now would it? ;-)

sqa_wizard wrote:Well, I can reproduce it now, using a utf-8 formatted file with BOM.

The (hidden) BOM prefix at the first line seems to inhibit a detection of the section header.
Yes, thanks for confirming.
User avatar
petermad
Power Member
Power Member
Posts: 14808
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

Well, saving without BOM would result in the same file as when saving as ANSI now would it
Only if the file is 7-bit ansi. If there are 8-bit ansi characters they will be saved differently when saved as ansi than when saved as utf8 (with or without bom).
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

white, wincmd.ini (and all other TC's INI and BAR files) can't be in UTF-8. Windows doesn't support UTF-8 for INI files. If you want Unicode, save file in UCS-16 (called just Unicode in Notepad) - all will work.

I think BOM for UTF-8 may cause your errors because Windows doesn't expect to see it in INI file.
User avatar
white
Power Member
Power Member
Posts: 4622
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Post by *white »

MVV wrote:white, wincmd.ini (and all other TC's INI and BAR files) can't be in UTF-8. Windows doesn't support UTF-8 for INI files. If you want Unicode, save file in UCS-16 (called just Unicode in Notepad) - all will work.

I think BOM for UTF-8 may cause your errors because Windows doesn't expect to see it in INI file.
It wasn't my choice to store it in UTF-8..

I noticed as soon as Total Commander wants to store some unicode characters in the ini, my ANSI ini is changed into UTF-8.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48083
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

It's unfortunately a limitation of the Windows functions to read ini files. They see the BOM at the beginning of the first line instead of square brackets, and therefore ignore it.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 4622
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Post by *white »

white wrote:It wasn't my choice to store it in UTF-8..

I noticed as soon as Total Commander wants to store some unicode characters in the ini, my ANSI ini is changed into UTF-8.
I think I made a mistake somewhere because I cannot reproduce it anymore. Maybe I did save the ini as utf-8 at some time and forgot about it.
Post Reply