Can I use echo to generate an UTF-8 text file?
For example if I want to generate a file that contains the character ę:
echo "abcd ę" > out.txt
(the batch file is encoded with UTF-8)
the result is an ANSI encoded file and the ę character is transformed into ê.
How can I convince echo to generate an UTF-8 file?
If it’s not possible, then can I change the encoding of the text file after creating it?
Is there any tool in the gnuwin32 package that can help me to change the encoding?
thanks
The problem was that the file contained the line:
and then Notepad2 and Firefox was changing the charset, showing Ä instead of ę. In plain Notepad, the file looks ok.
The solution was to add the UTF-8 signature (Byte Order Mark) at the beginning of the file:
(echo1 is from gnuwin32)
thanks for the answers