Quickly convert a lot of files to another encoding?
-
Hello.
So I’ve been translating a certain mod for a game, from Russian to Polish.
Even though saving in ANSI should save both polish and russian characters, it did not for some reason. The only way I managed to get the notepad to save both character types was saving in UCS-2 LE BOM.
Once all the work was done, I found out the files have to be in ANSI in order for them to compile correctly. And I don’t feel like exploring every folder, and check every file, then manually changing the encoding to ANSI.So here’s the question: Is there a program that can allow me to do it faster?
[BTW: Now that I reinstalled N++, it saves in ANSI correctly, shame that it’s too late]
-
Someone could write a script to do it, like using Notepad++'s PythonScript plugin. But batch-encoding conversion isn’t really Notepad++'s niche.
However, since you weren’t able to convince Notepad++ to do encodings properly to begin with, I did some googling for you. This superuser reply seems to do what you want… except you’d want
iconv -f UCS-2LE -t windows-1252
(or whatever the proper names for UCS-2-LE and “ANSI” are foriconv
)…EDIT: this site shows a list of iconv encoding names, with
UCS-2LE
listed among the assets. -
… or the answer right below that, showing a power-shell way; you could just use the encoding of
Unicode
, which is MS misnomer for UCS-2LE. See https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/out-file?view=powershell-6 for the otherout-file
encodings and documentation. -
Problem solved. Thanks for the answer!