I agree, aGerman's ConvertCP.exe utility would be an ideal solution. You want to translate to code page 65001. Add the /B option if you want a BOM in your output.
Alternatively, you could use my
JREPL.BAT utility. It is designed to do regular expression find/replace operations on text files, but it has the ability to read and write different encodings.
The following assumes the "ANSI" source encoding matches the default encoding used by your machine:
Code: Select all
call jrepl "$^" "" /f "input.txt" /o "output.txt|utf-8"
The above will terminate every line with carriage return linefeed (\r\n), regardless how the source lines were terminated. If you want to preserve the original line terminators, then add the /M option.
By default the output will include the BOM. If you don't want a BOM, then use /O "output.txt|utf-8|nb".
If the ANSI encoding does not match your machines default, then you will have to specify the encoding within the /I option. For example, if your encoding is Central/Eastern European code page 1250, then
Code: Select all
call jrepl "$^" "" /f "input.txt|windows-1250" /o "output.txt|utf-8"