Lister UTF-8 default view

English support forum

Moderators: white, sheep, Hacker, Stefan2

Post Reply
proof
Junior Member
Junior Member
Posts: 5
Joined: 2021-03-05, 12:56 UTC

Lister UTF-8 default view

Post by *proof »

Is there a way how to make UTF-8 (option 7) default in Lister? I can see only 4 options (text / binary / hex. / auto.) in configuration dialog. I cannot find it in help / wincmd.ini either.
User avatar
Gral
Power Member
Power Member
Posts: 781
Joined: 2005-01-26, 15:12 UTC

Re: Lister UTF-8 default view

Post by *Gral »

From TC help
Command line parameters
...
/S=L Start Lister directly, pass file name to it for viewing (requires full name including path). May include bookmark in html files, e.g. c:\test\test.html#bookmark
Accepts additional parameters separated by a colon, e.g. /S=L:AT1C1250
A ANSI/Windows text
S ASCII/DOS text
V Variable width text
T1..T8 View mode 1-8 (1: Text, 2: Binary, 3: Hex, 4: Multimedia, 5: HTML, 6: Unicode, 7: UTF-8, 8: Explorer Preview)
C<nr> Codepage, e.g. C1251 for Cyrillic
N Auto-detect, but no multimedia or plugins allowed
So, you can create button, eg. (copy code and paste on empty space on buttonbar):

Code: Select all

TOTALCMD#BAR#DATA
%COMMANDER_EXE% /S=L:T7 /i=%COMMANDER_INI%
%P%N
%COMMANDER_EXE%,24
Lister UTF-8

0
-1
or user command with these settings and remap "F3" keyboard shortcut to it.
User avatar
elgonzo
Power Member
Power Member
Posts: 840
Joined: 2013-09-04, 14:07 UTC

Re: Lister UTF-8 default view

Post by *elgonzo »

Note that this approach has unfortunately one disadvantage: Unlike the normal lister invocations, invoking the lister through execution of the TC executable does not keep the current search term active between different successive lister invocations done in this manner (and also do not carry from/to the "mother" TC instance). The search terms will become part of the list of search terms, but you can't rely on search keys/functions such as F3/F5 without the search dialog opening again in every lister instance opened in this manner. Not even adding the /O switch to the commandline will remedy this shortcoming. :(

That said, i also don't have a better suggestion to make, unfortunately. So, as of now, it's one of those cases where you take the good with the bad, i guess. But ideally, either the lister INI settings (and lister configuration dialog, too) should be enhanced to include startup options for Unicode/UTF-8 and such. Or the /O option should also be usable in conjunction with /S=, so that whatever component specified by the /S= argument is being invoked in the process context of the already running TC instance... :)
Last edited by elgonzo on 2021-03-05, 14:21 UTC, edited 2 times in total.
Windows 7 Pro x64 SP1
User avatar
Gral
Power Member
Power Member
Posts: 781
Joined: 2005-01-26, 15:12 UTC

Re: Lister UTF-8 default view

Post by *Gral »

Note, that my code uses main INI file, so, if you close this instance of Lister search is saved!
User avatar
elgonzo
Power Member
Power Member
Posts: 840
Joined: 2013-09-04, 14:07 UTC

Re: Lister UTF-8 default view

Post by *elgonzo »

Gral wrote: 2021-03-05, 14:08 UTC Note, that my code uses main INI file, so, if you close this instance of Lister search is saved!
My apologies. I was sloppy in writing my previous comment, and it is a bit misleading. The search term carries over as part of the list of search terms, but it does not carry over as active search term (i.e. the search term being used when pressing F3, for example). Sorry if my sloppy expression causes some confusion. :(
I have edited and hopefully improved my previous comment...
Windows 7 Pro x64 SP1
proof
Junior Member
Junior Member
Posts: 5
Joined: 2021-03-05, 12:56 UTC

Re: Lister UTF-8 default view

Post by *proof »

Microsoft changed default encoding in Notepad from ANSI to UTF-8 in Windows 10 version 1903. Since then I always have to press 7 in Lister to see text with national characters in files with UTF-8 encoding properly. I wonder that people do not ask for this option - I guess a lot of people is using Notepad & TC with Lister to create / see notes, scripts and so on...

Anyway I changed default encoding of Notepad back to ANSI in registry, until UTF-8 default view is supported natively in TC.

Thank you both very much for help.
User avatar
elgonzo
Power Member
Power Member
Posts: 840
Joined: 2013-09-04, 14:07 UTC

Re: Lister UTF-8 default view

Post by *elgonzo »

2proof
You might try some lister plug-ins that provide an alternative to lister's built-in text modes.
CudaLister comes to mind (which can be configured to use UTF-8 as default encoding, but can also detect the presence of UTF-8 or UTF-16 BOMs): viewtopic.php?f=6&t=48685&p=396896&hilit=CudaLister#p396896

There might be other lister plug-ins that you perhaps find more suitable for your needs, but i don't know. If you like to check out available lister plug-ins, look at:
https://www.ghisler.com/plugins.htm#lister
http://totalcmd.net/directory/lister.html
Windows 7 Pro x64 SP1
User avatar
petermad
Power Member
Power Member
Posts: 10311
Joined: 2003-02-05, 20:24 UTC
Location: Valsted, Denmark
Contact:

Re: Lister UTF-8 default view

Post by *petermad »

2proof
Microsoft changed default encoding in Notepad from ANSI to UTF-8 in Windows 10 version 1903. Since then I always have to press 7 in Lister to see text with national characters in files with UTF-8 encoding properly.
Hmm. out of the box TC detects UFT-8 files automatically.

If the file is saved without BOM (unfortunately default in Windows 10) then it can be a problem if there for example is only one line in the file (no line break present). I also seem to recall that it could be a problem if the first multi-byte character appears late in the file.
License #524 (1994)
Danish Total Commander Translator
TC 9.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (20H2) 64bit, 'Everything' 1.4.1.1005 x64
TC 3.21b2 on Android 6 & 11
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
proof
Junior Member
Junior Member
Posts: 5
Joined: 2021-03-05, 12:56 UTC

Re: Lister UTF-8 default view

Post by *proof »

Yes, automatic option in Lister configuration is able to detect UTF-8 and display it properly with national characters in most cases. But it also chooses e.g. binary view for some files and that is a problem for me. UTF-8 (option 7) is perfect for my needs, because it properly displays all the files that I use in expected way (-> not switching views depending on content).

I was just surprised there is such option in Lister menu and it is not possible to make it default, not even in wincmd.ini. I am grateful that you guys confirmed this, so I don't spend hours looking for that option...
User avatar
petermad
Power Member
Power Member
Posts: 10311
Joined: 2003-02-05, 20:24 UTC
Location: Valsted, Denmark
Contact:

Re: Lister UTF-8 default view

Post by *petermad »

2proof
I was just surprised there is such option in Lister menu and it is not possible to make it default
You can make it default for custom defined file type(s) - for example for *.txt files Via the "Define view mode by file type" in Listers "Multimedia" configuration - see: https://madsenworld.dk/tcmd/assignuft8.png

You can define the view mode for several files types at the same time - just enter the types separated by space - like: *.txt *.ini.

You can define more than one view method for an extension (separated vith comma - like: 7,1) - then pressing '4' multiple times will change only through these methods.
Last edited by petermad on 2021-03-06, 12:01 UTC, edited 1 time in total.
License #524 (1994)
Danish Total Commander Translator
TC 9.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (20H2) 64bit, 'Everything' 1.4.1.1005 x64
TC 3.21b2 on Android 6 & 11
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
proof
Junior Member
Junior Member
Posts: 5
Joined: 2021-03-05, 12:56 UTC

Re: Lister UTF-8 default view

Post by *proof »

I used that way to make UTF-8 view default for all file types *.* and that seems to work as I need. Thanks a lot!
User avatar
petermad
Power Member
Power Member
Posts: 10311
Joined: 2003-02-05, 20:24 UTC
Location: Valsted, Denmark
Contact:

Re: Lister UTF-8 default view

Post by *petermad »

2proof
I used that way to make UTF-8 view default for all file types *.*
I guess you never view images, or other media files - they don't look good in text view ;-)
License #524 (1994)
Danish Total Commander Translator
TC 9.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (20H2) 64bit, 'Everything' 1.4.1.1005 x64
TC 3.21b2 on Android 6 & 11
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
proof
Junior Member
Junior Member
Posts: 5
Joined: 2021-03-05, 12:56 UTC

Re: Lister UTF-8 default view

Post by *proof »

No, I don't use Lister for that. When I press F3 in TC, I expect to see "the code". And I still have the possibility to switch the view manually... so I am happy now. :-)
Post Reply