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

后端 未结 4 2141
隐瞒了意图╮
隐瞒了意图╮ 2020-12-01 09:16

I want to use iconv to convert files on my Mac. The goal is to go from \"Windows ANSI\" to \"whatever Windows Notepad saves, if you tell it to use UFT8\".

4条回答
  •  渐次进展
    2020-12-01 09:41

    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 >.

提交回复
热议问题