在Linux上遇到了文本格式的问题:ISO-8859 text 出现了乱码,需要转换格式到UTF-8
[lf_bde@DSJ-NLKF-96 ks2016]$ file dwa_v_m_guoan_comp_011_201608.txt
dwa_v_m_guoan_comp_011_201608.txt: ISO-8859 text
iconv的用法是:
iconv -f from-encoding -t to-encoding inputfile -o outputfile
于是按照自己的想法 是把ISO-8859 text 转换到 UTF-8格式 于是:
iconv -f ISO-8859 -t UTF-8 dwa_v_m_guoan_comp_011_201608.txt1 -o dwa_v_m_guoan_comp_011_20160801.txt
但是,并没有成功,出现了错误:
iconv: conversion to `ISO-8859' is not supported
Try `iconv --help' or `iconv --usage' for more information.
于是,换了一下写法;
iconv -f gbk -t UTF-8 dwa_v_m_guoan_comp_011_201608.txt -o dwa_v_m_guoan_comp_011_201608.txt
查看文件,成功了;
[lf_bde@DSJ-NLKF-96 ks2016]$ file dwa_v_m_guoan_comp_011_201608.txt
dwa_v_m_guoan_comp_011_201608.txt: UTF-8 Unicode text