Echo UTF-8 characters in windows batch

后端 未结 5 1802
暖寄归人
暖寄归人 2021-02-03 22:41

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

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-03 23:04

    chcp 65001

    as mention by @cuixiping is a good answer but it require to change cmd default font to Lucida Console for example, as you can read here: https://superuser.com/questions/237081/whats-the-code-page-of-utf-8#272184

    and of course, as mentioned by @BearCode, the text should be in utf-8… in my case, with Vim under GNU/Linux with remote access, but notepad++ is right way too!

提交回复
热议问题