Unicode hidden text batch file for Ansi text

How can I convert a directory with existing text from Unicode to ANSI with a batch file? Is there any tool I can use to scroll through files and perform conversion?

+4
source share
2 answers

See https://superuser.com/questions/27060/batch-convert-files-for-encoding-or-line-ending . In particular, iconv looks exactly like you.

You are looking for a backlink posted there, so you need something like this:

$ iconv -f utf-8 -t windows-1252 infile > outfile 
+5
source

EDIT - The following converts UTF-16 to specification. I do not think it works with any other UTF formats. I know this does not work for UTF-8. I am not sure about UTF-32 with specification

 for %%F in (*.txt) do type "%%F" >"%%~nF.converted" 

If run from the command line, use one percent % instead of double percent %% .

After checking the correctness of the converted files, you can

 del *.txt ren *.converted *.txt 
+4
source

Source: https://habr.com/ru/post/1389945/


All Articles