I have this file encoded as utf-8:
Code: Select all
ñandú
Code: Select all
chcp 65001
(set /p "content=") < in.txt
echo %content%
Code: Select all
nandu
Moderator: DosItHelp
Code: Select all
ñandú
Code: Select all
chcp 65001
(set /p "content=") < in.txt
echo %content%
Code: Select all
nandu
SS64 wrote:https://ss64.com/nt/syntax-redirection.html
Code: Select all
Unicode
The CMD Shell can redirect ASCII/ANSI (the default) or Unicode (UCS-2 le) but not UTF-8.
This can be selected by launching CMD /A or CMD /U
With the default settings a UCS-2 file can be converted by redirecting it (note it's the redirection not the TYPE/MORE command that makes the encoding change)
TYPE unicode.txt > asciifile.txt
European characters like ABCàéÿ will usually convert correctly, but others like £¥ƒ€ will become random extended ASCII characters: œ¾Ÿ?