Internal command/plugin to convert ANSI<->UTF-8 or other encodings?
Moderators: Hacker, petermad, Stefan2, white
Internal command/plugin to convert ANSI<->UTF-8 or other encodings?
The Subject should be self-explanatory. Is there a command or if not, a plugin that allows to manipulate and convert (especially in batch a group of files) from one encoding to another one?
Thanks
Thanks
Regards,
Sergio
TCmd license #12059
TC11.03x86/x64 | Win11 Pro
Sergio
TCmd license #12059
TC11.03x86/x64 | Win11 Pro
Re: Internal command/plugin to convert ANSI<->UTF-8 or other encodings?
I'm currently using Notepad++, but the conversion is on a file-by-file basis.
The ability to convert a group of files in a folder directly from within TC would be a time saver.
Yesterday I found a (pretty old) packer plugin that (among regexp substitutions and other functions) can also be used for ANSI->UTF-8, though it doesn't do the needed UTF-8->ANSI conversion.
RegXtract: https://totalcmd.net/plugring/reg_ext.html
The ability to convert a group of files in a folder directly from within TC would be a time saver.
Yesterday I found a (pretty old) packer plugin that (among regexp substitutions and other functions) can also be used for ANSI->UTF-8, though it doesn't do the needed UTF-8->ANSI conversion.
RegXtract: https://totalcmd.net/plugring/reg_ext.html
Regards,
Sergio
TCmd license #12059
TC11.03x86/x64 | Win11 Pro
Sergio
TCmd license #12059
TC11.03x86/x64 | Win11 Pro
Re: Internal command/plugin to convert ANSI<->UTF-8 or other encodings?
My editor PSPad has the needed conversion under
Encoding > Batch encoding conversion
http://www.pspad.com/en/
Encoding > Batch encoding conversion
http://www.pspad.com/en/
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: Internal command/plugin to convert ANSI<->UTF-8 or other encodings?
Thanks @Horst.Epp. Not the perfect solution (given TC is the main goal of this thread), but it would surely help.
I hope a plugin for this may be developed in the future (as sw developing sadly exceeds my skills
).
[edit] Found a temporary solution with Notepad++
- Open the file
- Start macro recording
- Do the conversion
- Save and close the file
Then, I can run the 'Run Macro multiple times' from the Macro menu with several opened files.
Again, not perfect, but does the job.
I hope a plugin for this may be developed in the future (as sw developing sadly exceeds my skills

[edit] Found a temporary solution with Notepad++
- Open the file
- Start macro recording
- Do the conversion
- Save and close the file
Then, I can run the 'Run Macro multiple times' from the Macro menu with several opened files.
Again, not perfect, but does the job.
Regards,
Sergio
TCmd license #12059
TC11.03x86/x64 | Win11 Pro
Sergio
TCmd license #12059
TC11.03x86/x64 | Win11 Pro
Re: Internal command/plugin to convert ANSI<->UTF-8 or other encodings?
The PSPad version does this much easierHelix751 wrote: 2023-08-06, 15:54 UTC Thanks @Horst.Epp. Not the perfect solution (given TC is the main goal of this thread), but it would surely help.
I hope a plugin for this may be developed in the future (as sw developing sadly exceeds my skills).
[edit] Found a temporary solution with Notepad++
- Open the file
- Start macro recording
- Do the conversion
- Save and close the file
Then, I can run the 'Run Macro multiple times' from the Macro menu with several opened files.
Again, not perfect, but does the job.
- Select your files/dirs, incl. Sub-dirs if needed
- Set the from/to encoding option
- Start
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: Internal command/plugin to convert ANSI<->UTF-8 or other encodings?
2Horst.Epp The only issues here are this isn't a TC solution and I don't use PSPad nor have it installed (despite its small size). I gave it a try it in the past, but at last sticked with N++ and don't have the time to switch editors again. Thanks for the suggestion, anyway.
Regards,
Sergio
TCmd license #12059
TC11.03x86/x64 | Win11 Pro
Sergio
TCmd license #12059
TC11.03x86/x64 | Win11 Pro
Re: Internal command/plugin to convert ANSI<->UTF-8 or other encodings?
Just in case you want to use TC to identify files before opening them, you can try EnfInfo https://www.ghisler.ch/board/viewtopic.php?t=38408
Edit: if powershell is an option you can find powershell scripts to (batch) convert files as well (just google it), there are probably command line tools as well so you can call these in a batch file via a button or short cut
Edit: if powershell is an option you can find powershell scripts to (batch) convert files as well (just google it), there are probably command line tools as well so you can call these in a batch file via a button or short cut
F4MiniMenu (Forum) - Open selected file(s) from TC in defined editor(s) - A (minimalistic) clone of F4Menu
Source at GitHub (AutoHotkey). TCSyncComments (copy file comments)
Source at GitHub (AutoHotkey). TCSyncComments (copy file comments)
Re: Internal command/plugin to convert ANSI<->UTF-8 or other encodings?
As you should understand from previous comments, codepage conversion is a feature of good text editors. TC does not provide ANY text editor, so you shouldn't expect any TC solution for codepage conversion.
Andrzej P. Wozniak
Polish subforum moderator
Polish subforum moderator
PowerShell: command to convert ANSI<->UTF-8 or other encodings?
Helix751 wrote: 2023-08-06, 02:16 UTC The Subject should be self-explanatory. Is there a command or if not, a plugin that allows to manipulate and convert (especially in batch a group of files) from one encoding to another one?
Thanks
You may try this copy&paste button-code with an PowerShell script:
- select the file(s) and execute this button
--------------------------------
TOTALCMD#BAR#DATA
powershell -noexit
Get-Content '%F'|ForEach{$N=$((GI $_).BaseName +'_UTF8'+(GI $_).Extension);$_;$N;Get-Content $_|Set-Content $N -Encoding UTF8}
powershell
Encode selected file(s) to unicode;bigendianunicode;utf8;utf7;utf32;ascii(ANSI);default;oem
-1
--------------------------------
There will be new, converted files created, with the encoding mode written to the filename.
Change the string UTF8 to the wanted one, f.ex. ascii:
Get-Content '%L'|ForEach{$N=$((GI $_).BaseName +'_UTF8'+(GI $_).Extension);$_;$N;Get-Content $_|Set-Content $N -Encoding UTF8}
Get-Content '%L'|ForEach{$N=$((GI $_).BaseName +'_ascii'+(GI $_).Extension);$_;$N;Get-Content $_|Set-Content $N -Encoding ascii}
Capabilities are one off unicode;bigendianunicode;utf8;utf7;utf32;ascii(ANSI);default;oem
VON:
HISTORY.txt
LIESMICH.TXT
README.TXT
ZU:
HISTORY_UTF8.txt
LIESMICH_UTF8.TXT
README_UTF8.TXT
Perhaps a better approach is to save the converted files while keeping there name into a new sub folder named 'encoded':
--------------------------------
TOTALCMD#BAR#DATA
powershell -noexit
$N='encoded';If(-Not(Test-Path $N)){New-Item $N -type 'dir'}; Get-Content '%F'|ForEach{Get-Content $_ | Set-Content $N\$_ -Encoding UTF8}
powershell
Encode selected file(s) to unicode;bigendianunicode;utf8;utf7;utf32;ascii;default;oem
-1
--------------------------------
VON:
HISTORY.txt
LIESMICH.TXT
README.TXT
ZU:
encoded\HISTORY.txt
encoded\LIESMICH.TXT
encoded\README.TXT
You can also change the script code to just overwrite the existing files with the encoded version.
HTH?

Re: Internal command/plugin to convert ANSI<->UTF-8 or other encodings?
2Helix751
nhrt
Code: Select all
TOTALCMD#BAR#DATA
%COMMANDER_PATH%\Utils\nhrt\nhrt.exe
-cp:auto,utf8bom -notitle -o:q %S
wcmicon2.dll,67
Change the encoding of the selected text files to UTF-8
1
Overquoting is evil! 👎
Re: Internal command/plugin to convert ANSI<->UTF-8 or other encodings?
2Fla$her
Thanks for the nhrt link.
Nice useful tool
Thanks for the nhrt link.
Nice useful tool

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: Internal command/plugin to convert ANSI<->UTF-8 or other encodings?
2Horst.Epp
You're welcome. I've been using it for many years. ✌
You're welcome. I've been using it for many years. ✌
Overquoting is evil! 👎
Re: Internal command/plugin to convert ANSI<->UTF-8 or other encodings?
2Fla$her
Thanks for the tip! Looks and works quite fine.
Thanks for the tip! Looks and works quite fine.
Regards,
Sergio
TCmd license #12059
TC11.03x86/x64 | Win11 Pro
Sergio
TCmd license #12059
TC11.03x86/x64 | Win11 Pro
Re: Internal command/plugin to convert ANSI<->UTF-8 or other encodings?
Overquoting is evil! 👎