[SOLVED] Use UTF-8 with byte-order mark when creating a new .txt file
Moderators: Hacker, petermad, Stefan2, white
Re: Use UTF-8 with byte-order mark when creating a new .txt file
Editor should do what was required, not what someone might recommend. Be it BOM-less UTF-16LE or plain ASCII.
It was explicitly stated that CP1250 was needed, and you insist on squeezing in a BOM regardless?
Thanks, but no.
It was explicitly stated that CP1250 was needed, and you insist on squeezing in a BOM regardless?
Thanks, but no.
Re: Use UTF-8 with byte-order mark when creating a new .txt file
It looks like you really don’t fully understand what I’m writing.
An editor - any editor - of course has its own rules according to which it works with a file.
And of course - if it copes the way you need it, that’s great and you’ll be happy to use it.
BUT! There are situations/editors - when it is NECESSARY to do something preliminary so that further work is a pleasure.
So, in order to quickly solve this problem, it is proposed to introduce an option that would guarantee that when Total creates a file,
then it will be done in the encoding that I need (and in 99/100 it is UTF-8), because otherwise ALL my editors will interpret such a file as an ANSI (CP1251) encoded. And this is quite understandable in concept - because they are simply working with an empty file(0 bytes) that they did not create themselves, they were only given the path to it.
Therefore, if you simply have one pleasure and not an editor - you will not need to use this option and everything will be fine for you. But I would enable it and always get the creation of the text file I need in UTF-8 encoding.
An editor - any editor - of course has its own rules according to which it works with a file.
And of course - if it copes the way you need it, that’s great and you’ll be happy to use it.
BUT! There are situations/editors - when it is NECESSARY to do something preliminary so that further work is a pleasure.
So, in order to quickly solve this problem, it is proposed to introduce an option that would guarantee that when Total creates a file,
then it will be done in the encoding that I need (and in 99/100 it is UTF-8), because otherwise ALL my editors will interpret such a file as an ANSI (CP1251) encoded. And this is quite understandable in concept - because they are simply working with an empty file(0 bytes) that they did not create themselves, they were only given the path to it.
Therefore, if you simply have one pleasure and not an editor - you will not need to use this option and everything will be fine for you. But I would enable it and always get the creation of the text file I need in UTF-8 encoding.
Last edited by AntonyD on 2024-02-07, 13:36 UTC, edited 2 times in total.
#146217 personal license
Re: Use UTF-8 with byte-order mark when creating a new .txt file
With my Editor (PSPad) I don't have this problem but nevertheless,
I support having an option to let TC create files with the configured requested encoding.
I support having an option to let TC create files with the configured requested encoding.
Windows 11 Home, Version 24H2 (OS Build 26100.3915)
TC 11.51 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.2.1 x64
TC 11.51 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.2.1 x64
Re: Use UTF-8 with byte-order mark when creating a new .txt file
I don't understand that at all:Horst.Epp wrote: 2024-02-07, 09:30 UTC ... an option to let TC create files with the configured requested encoding.
With the templates, that have just been introduced, all of this is now possible.
Or maybe not?
Joube
Re: Use UTF-8 with byte-order mark when creating a new .txt file
2JOUBE
You are right, but only after assigning Shift-F4 to cm_edit with parameters
You are right, but only after assigning Shift-F4 to cm_edit with parameters

Windows 11 Home, Version 24H2 (OS Build 26100.3915)
TC 11.51 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.2.1 x64
TC 11.51 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.2.1 x64
Re: Use UTF-8 with byte-order mark when creating a new .txt file
And, where is the problem to assign this?Horst.Epp wrote: 2024-02-07, 11:06 UTC 2JOUBE
You are right, but only after assigning Shift-F4 to cm_edit with parameters![]()
Re: Use UTF-8 with byte-order mark when creating a new .txt file
For example, how would you define the encoding: UTF-8 with byte-order mark
in a command starting with cm_Edit?
My attempt ended here:
I have searched the TC help for the keyword "encoding".
I know how to redefine Shift+F4 with an em_command.
in a command starting with cm_Edit?
My attempt ended here:
Code: Select all
cm_Edit /CGL1N="_.txt"
I know how to redefine Shift+F4 with an em_command.
Re: Use UTF-8 with byte-order mark when creating a new .txt file
Those who need UTF-8 less than in 1/100 cases would hardly appreciate genius idea of making it mandatory.
Try AkelPad.AntonyD wrote: 2024-02-07, 07:25 UTC otherwise ALL my editors will interpret such a file as an ANSI (CP1251) encoded.
An alternative suggestion: Disable pre-creation of empty files for editor.
Re: Use UTF-8 with byte-order mark when creating a new .txt file
JOUBE wrote: 2024-02-07, 10:37 UTC I don't understand that at all:
With the templates, that have just been introduced, all of this is now possible.
As mentioned, by using templates.tuska wrote: 2024-02-07, 13:27 UTC For example, how would you define the encoding: UTF-8 with byte-order mark
in a command starting with cm_Edit?
My attempt ended here:I have searched the TC help for the keyword "encoding".Code: Select all
cm_Edit /CGL1N="_.txt"
Re: Use UTF-8 with byte-order mark when creating a new .txt file
Thanks for the help to help yourself

Note: Without the "HISTORY.TXT" file, I probably wouldn't have been able to do this example.
- C:\totalcmd\Templates\UTF-8-BOM.txt -> Encoding "UTF-8 with Signature"
- C:\totalcmd\usercmd.ini
Code: Select all
[em_UTF-8-BOM_Shift-F4] button= cmd=cm_Edit menu=/CGL1 /T="C:\totalcmd\Templates" /N="_.txt"|https://www.ghisler.ch/board/viewtopic.php?p=449643#p449643|Sample: cm_Edit /CGL0 /T="c:\totalcmd\template" /N="<1-10>[C].xls" param=/CGL1 /T="C:\totalcmd\Templates" /N="_.txt"
- C:\totalcmd\wincmd.ini
Code: Select all
[Shortcuts] S+F4=em_UTF-8-BOM_Shift-F4
- Configuration > Edit/View > Editor for F4:
C:\Users\user\AppData\Local\Programs\EmEditor\EmEditor.exe /cd "%1"
If the file "UTF-16LE with Signature.txt" with this encoding is located in C:\totalcmd\Templates\ and
this is located BEFORE the file "UTF-8-BOM.txt" with this encoding, then after Shift+F4
the file "_.txt" is created (immediately! *)) with the encoding "UTF-16LE with Signature".
This means that the encoding of the first (topmost) file is used when creating a new text file with Shift+F4.
The settings in the "usercmd.ini" or "wincmd.ini" file do NOT need to be changed!
-----------------
*) Parameter /G ... --> The parameter /G ensures that the file is created IMMEDIATELY.
If this parameter is omitted, the question appears after Shift+F4: "Enter file name to edit:"
AND the name that was saved under parameter /N is suggested, e.g. /N="_.txt" --> _.txt
Only after clicking on the "OK" button is the file saved and opened in the defined editor, e.g. EmEditor.
Last edited by tuska on 2024-02-07, 19:46 UTC, edited 4 times in total.
Re: Use UTF-8 with byte-order mark when creating a new .txt file
There is no problem, but a new user will not know about
without intensive reading of the help.
An encoding option in the GUI config under the Editor entry would be much easier.
Windows 11 Home, Version 24H2 (OS Build 26100.3915)
TC 11.51 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.2.1 x64
TC 11.51 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.2.1 x64
Re: Use UTF-8 with byte-order mark when creating a new .txt file
The solution is to store an empty anyname.txt file into the Template directorytuska wrote: 2024-02-07, 13:27 UTC For example, how would you define the encoding: UTF-8 with byte-order mark
in a command starting with cm_Edit?
which is formatted as UTF-8 with BOM.
Then redefine Shift-F4 to
cm_edit /CT
Windows 11 Home, Version 24H2 (OS Build 26100.3915)
TC 11.51 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.2.1 x64
TC 11.51 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.2.1 x64
Re: Use UTF-8 with byte-order mark when creating a new .txt file
Thank you, I have already solved it for me as indicated here.Horst.Epp wrote: 2024-02-07, 16:35 UTCThe solution is to store an empty anyname.txt file into the Template directorytuska wrote: 2024-02-07, 13:27 UTC For example, how would you define the encoding: UTF-8 with byte-order mark
in a command starting with cm_Edit?
which is formatted as UTF-8 with BOM.
Then redefine Shift-F4 to
cm_edit /CT
Re: Use UTF-8 with byte-order mark when creating a new .txt file
Looks rather complicated compared to my suggestion

Windows 11 Home, Version 24H2 (OS Build 26100.3915)
TC 11.51 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.2.1 x64
TC 11.51 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.2.1 x64
Re: Use UTF-8 with byte-order mark when creating a new .txt file
With your suggestion:
cm_edit /CT
S+F4=em_UTF-16LE_with_Signature (only example)
I get this message:
"Enter file name to edit:"
and after entering a file name I get encoding "ANSI" in EmEditor.
This is not what I had in mind.
I would like to leave it at that and continue to use my solution above.
If anyone else is interested, perhaps you can give a detailed description.