[SOLVED] Use UTF-8 with byte-order mark when creating a new .txt file

English support forum

Moderators: white, Hacker, petermad, Stefan2

User avatar
AntonyD
Power Member
Power Member
Posts: 1211
Joined: 2006-11-04, 15:30 UTC
Location: Russian Federation

Re: Use UTF-8 with byte-order mark when creating a new .txt file

Post by *AntonyD »

2tuska
nice decision! and it's doable)) and looks workable)))
#146217 personal license
User avatar
tuska
Power Member
Power Member
Posts: 3711
Joined: 2007-05-21, 12:17 UTC

Re: Use UTF-8 with byte-order mark when creating a new .txt file

Post by *tuska »

AntonyD wrote: 2024-02-07, 19:18 UTC 2tuska
nice decision! and it's doable)) and looks workable)))
Thanks go to white, who put me on the right track and also to other users
whose advice made me pay attention in the first place. :)
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6379
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Use UTF-8 with byte-order mark when creating a new .txt file

Post by *Horst.Epp »

tuska wrote: 2024-02-07, 18:34 UTC With your suggestion:
cm_edit /CT
S+F4=em_UTF-16LE_with_Signature (only example)

I get this message:
"Enter file name to edit:"
That's not my suggestion.
I don't see why you need this.
When I store an anyname.txt template file with your wanted encoding,
there is no problem with the simple Shift-F4 definition
cm_edit /CT
Windows 11 Home x64 Version 23H2 (OS Build 22631.3155)
TC 11.03 x64 / x86
Everything 1.5.0.1367a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.63
QAP 11.6.2.3.2 x64
User avatar
petermad
Power Member
Power Member
Posts: 14626
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Use UTF-8 with byte-order mark when creating a new .txt file

Post by *petermad »

2tuska
If you use cm_edit /CT the template file has to be located in Windows' default template directory - usually %APPDATA%\Microsoft\Windows\Templates = %$Templates%

Some sources say the Windows' templates directory is in APPDATA%\Microsoft\Templates so I guess the best way to find the dir is by using cd %$Templates%

There is also a Junction (LNK) to the Templates folder in %USERPROFILE% but it will have a localized name (Skabeloner in Danish).
License #524 (1994)
Danish Total Commander Translator
TC 11.02 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1366a
TC 3.50b3 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6379
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Use UTF-8 with byte-order mark when creating a new .txt file

Post by *Horst.Epp »

petermad wrote: 2024-02-08, 12:41 UTC 2tuska
If you use cm_edit /CT the template file has to be located in Windows' default template directory - usually %APPDATA%\Microsoft\Windows\Templates = %$Templates%

Some sources say the Windows' templates directory is in APPDATA%\Microsoft\Templates so I guess the best way to find the dir is by using cd %$Templates%

There is also a Junction (LNK) to the Templates folder in %USERPROFILE% but it will have a localized name (Skabeloner in Danish).
I made a link Templates to the Microsoft templates under the TC home dir.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3155)
TC 11.03 x64 / x86
Everything 1.5.0.1367a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.63
QAP 11.6.2.3.2 x64
User avatar
tuska
Power Member
Power Member
Posts: 3711
Joined: 2007-05-21, 12:17 UTC

Re: Use UTF-8 with byte-order mark when creating a new .txt file

Post by *tuska »

2petermad

Windows' default template directory - %$Templates% was the solution!
Many thanks for your support!

2Horst.Epp
Horst.Epp wrote: 2024-02-08, 10:26 UTC When I store an anyname.txt template file with your wanted encoding,
there is no problem with the simple Shift-F4 definition
cm_edit /CT
I have unfortunately overlooked the note in the help: "By default, the user's template directory will be used.",
as I have never stored a template in this directory.

Now that I know the/your solution, I can say: Of course you can also solve the issue this way :)
Thanks!


cd %$Templates% - C:\Users\user\AppData\Roaming\Microsoft\Windows\Templates\

Code: Select all

C:\Users\user\AppData\Roaming\Microsoft\Windows\Templates\UTF-8-BOM.txt
C:\Users\user\AppData\Roaming\Microsoft\Windows\Templates\z_UTF-16LE with Signature.txt
usercmd.ini

Code: Select all

[em_UTF-8-BOM_Shift-F4_%$Templates%_cm_edit_CT]
button=
cmd=cm_edit
param=/CT
menu=cm_edit /CT || cd %$Templates%|https://www.ghisler.ch/board/viewtopic.php?p=449648#p449648|https://www.ghisler.ch/board/viewtopic.php?p=449747#p449747 Use UTF-8 with byte-order mark when creating a new .txt file
wincmd.ini

Code: Select all

[Shortcuts]
S+F4=em_UTF-8-BOM_Shift-F4_%$Templates%_cm_edit_CT
;S+F4=em_UTF-8-BOM_Shift-F4_%$Templates%_cm_edit_CT https://www.ghisler.ch/board/viewtopic.php?p=449747#p449747 petermad: If you use cm_edit /CT the template file has to be located in Windows' default template directory - usually %APPDATA%\Microsoft\Windows\Templates = %$Templates%
User avatar
tuska
Power Member
Power Member
Posts: 3711
Joined: 2007-05-21, 12:17 UTC

Re: Use UTF-8 with byte-order mark when creating a new .txt file

Post by *tuska »

For me, the issue is solved.

Thanks again for your support.

@Moderator
Please add [SOLVED] in the first post (I am not allowed to do that in this case).
Perhaps this post should be moved to the "Total Commander (English)" forum?
User avatar
white
Power Member
Power Member
Posts: 4553
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Use UTF-8 with byte-order mark when creating a new .txt file

Post by *white »

tuska wrote: 2024-02-12, 15:38 UTC @Moderator
Please add [SOLVED] in the first post (I am not allowed to do that in this case).
You can edit the post making the moderator message no longer relevant and remove the moderator message.

Moderator message from: white » 2024-02-12, 16:32 UTC

tuska wrote: 2024-02-12, 15:38 UTC Perhaps this post should be moved to the "Total Commander (English)" forum?
Done.
User avatar
tuska
Power Member
Power Member
Posts: 3711
Joined: 2007-05-21, 12:17 UTC

Re: [SOLVED] Use UTF-8 with byte-order mark when creating a new .txt file

Post by *tuska »

2white
Thanks!
Post Reply