如何将*.txt文件转换为Unicode

6 unicode

我有一个要求,客户端将提供编码ANSI的文件,但我的系统只能成功读取UNICODE中的文件.那么我该如何解决这个问题呢?我知道当我"保存为"文件为UNICODE编码时,文件被拾取.很难让客户遵守我们的要求.那么我可以为此文件夹设置任何批处理程序,将此文件转换为UNICODE,然后选择吗?

Joh*_*itb 17

iconv 可以这样做:

Usage: iconv [OPTION...] [FILE...]
Convert encoding of given files from one encoding to another.

 Input/Output format specification:
  -f, --from-code=NAME       encoding of original text
  -t, --to-code=NAME         encoding for output

 Information:
  -l, --list                 list all known coded character sets

 Output control:
  -c                         omit invalid characters from output
  -o, --output=FILE          output file
  -s, --silent               suppress warnings
      --verbose              print progress information

  -?, --help                 Give this help list
      --usage                Give a short usage message
  -V, --version              Print program version

Mandatory or optional arguments to long options are also mandatory or optional
for any corresponding short options.

For bug reporting instructions, please see:
<http://www.gnu.org/software/libc/bugs.html>.
Run Code Online (Sandbox Code Playgroud)


Ser*_*ier 10

ANSI和Unicode都不是编码.在使用建议的工具之一(例如iconv)之前,您必须知道输入文件的ANSI代码页和Unicode编码(UTF8或UTF16 - LE或BE).

  • 在Windows系统上,"Unicode"通常表示UTF-16. (3认同)

Jan*_*kel 5

recode可以完成这项工作.