iconv: Converting from Windows ANSI to UTF-8 with BOM

核能气质少年 提交于 2019-11-27 07:48:30

You can add it manually by first echoing the bytes into the file:

echo -ne '\xEF\xBB\xBF' > names.utf8.csv

and then concatenating your required information at the end:

iconv -f CP1252 -t UTF-8  names.csv >> names.utf8.csv

Note the >> rather than >.

Note that "Windows ANSI" may not be CP1252 - that is configured by users.

I needed the opossite. (covert german text from UTF-8 to ANSI)

So command I used:
1. iconv -l (check available formats)
2. iconv -f UTF8 -t MS-ANSI de.txt > output.txt

and now if I open output.txt it is already in ANSI. Job done.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!