Using iconv to convert from UTF-16BE to UTF-8 with

2019-04-21 03:01发布

I'm trying to convert a UTF-16BE encoded file (byte order mark: 0xFE 0xFF) to UTF-8 using iconv like so:

iconv -f UTF-16BE -t UTF-8 myfile.txt

The resulting output, however, has the UTF-8 byte order mark (0xEF 0xBB 0xBF) and that is not what I need. Is there a way to tell iconv (or is there an equivalent encoding) to not put a BOM in the UTF-8 result?

1条回答
等我变得足够好
2楼-- · 2019-04-21 03:43

Experiment shows that indicating UTF-16 rather than UTF-16BE does what you want:

iconv -f UTF-16 -t UTF-8 myfile.txt
查看更多
登录 后发表回答