[TC 11.57rc5] Bad encoding checking in "Compare by content"

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: Stefan2, Hacker, petermad

Post Reply
User avatar
yyang
Member
Member
Posts: 174
Joined: 2007-03-27, 11:41 UTC
Location: China

[TC 11.57rc5] Bad encoding checking in "Compare by content"

Post by *yyang »

"Compare by content" sometimes fails to detect the file encoding despite the value of CompareUtf8Detect. My OS is Windows 10 Simplified Chinese Edition.

To reproduce:
  1. Save "好的" into good.txt, and "坏的" into bad.txt, both in UTF-8.
  2. Select only good.txt and start "Compare by content".
  3. Enter the file path of bad.txt manually, and click the "Compare" button. Both files will displayed in the ANSI codepage, not UTF-8.
This issue also happens when both file paths are entered manually.
#147523
User avatar
petermad
Power Member
Power Member
Posts: 17375
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [TC 11.57rc5] Bad encoding checking in "Compare by content"

Post by *petermad »

Confirmed as described. Both files saved with BOM

The same applies when saved as Unicode files
License #524 1994
Danish TC Translator
TC 11.58 32+64bit on Windows XP 32bit & Windows 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1416b
TC 3.62 on Android 6, 13, 15 & 16
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 53139
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.57rc5] Bad encoding checking in "Compare by content"

Post by *ghisler(Author) »

Not a bug, this is by design: The encoding check is only performed when the compare tool is initially opened. It's not done when changing the names after opening the tool, otherwise it would not be possible to manually change the encoding.

Moderator message from: ghisler(Author) » 2026-04-28, 07:51 UTC

Moved to will not be changed
Author of Total Commander
https://www.ghisler.com
User avatar
yyang
Member
Member
Posts: 174
Joined: 2007-03-27, 11:41 UTC
Location: China

Re: [TC 11.57rc5] Bad encoding checking in "Compare by content"

Post by *yyang »

Thanks for the reply! Maybe it'll be better if the ANSI<->ANSI button dynamically displays the current (potentially detected) encodings whenever either or both file paths are reset. But setting the encodings manually with this button is good enough.
#147523
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 53139
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.57rc5] Bad encoding checking in "Compare by content"

Post by *ghisler(Author) »

You can select the two files before opening the compare tool, either both in the same panel, or one in each panel. This way they will be detected automatically.
Author of Total Commander
https://www.ghisler.com
User avatar
yyang
Member
Member
Posts: 174
Joined: 2007-03-27, 11:41 UTC
Location: China

Re: [TC 11.57rc5] Bad encoding checking in "Compare by content"

Post by *yyang »

Yes, I'm familiar with this usage. :)
#147523
User avatar
white
Power Member
Power Member
Posts: 6940
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [TC 11.57rc5] Bad encoding checking in "Compare by content"

Post by *white »

Wouldn't it be better if it also starts with Auto-detect when the tool is started with less than 2 files and the comparing isn't done yet?

Then the button looks like this:

Code: Select all

[  Auto<->Auto  ]
And the dialog looks like this:

Code: Select all

Choose Encoding

Left:                        Right:
(*) Auto-detect              (*) Auto-detect
( ) ANSI (plain text)        ( ) ANSI (plain text)
( ) Unicode (UTF-16)         ( ) Unicode (UTF-16)
( ) Unicode MacOS            ( ) Unicode MacOS
( ) UTF-8                    ( ) UTF-8 
                            
     [    OK    ]  [   Cancel   ]  [   Help   ]
If it is set to Auto-detect, and the Compare button is clicked, encoding is determined and set to the determined encoding for left and right.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 53139
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.57rc5] Bad encoding checking in "Compare by content"

Post by *ghisler(Author) »

That's an interesting idea, but it wouldn't solve all problems, e.g. when the user changed one of the file names later to a file with different encoding type.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 6940
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [TC 11.57rc5] Bad encoding checking in "Compare by content"

Post by *white »

ghisler(Author) wrote: 2026-04-28, 20:31 UTC That's an interesting idea, but it wouldn't solve all problems, e.g. when the user changed one of the file names later to a file with different encoding type.
Why is that a problem? When he changes the filename, the user can set encoding to Auto-detect before hitting the Compare button? Or when he changes the filename the encoding could be set to auto-detect automatically, and if the user wants to he can choose something different before hitting the Compare button.
Post Reply