zoukankan      html  css  js  c++  java
  • ubuntu下编码转换工具

    ubuntu打开windows下的txt或者代码文件,经常会出现乱码,

    ubuntu自带一种转换工具,是命令行的,下面提供一种最简单的方法进行转换

    比如要转换的文件为1.txt,进入1.txt的目录

    输入如下命令:

    iconv -f gbk -t utf8 -c 1.txt > 2.txt

    然后打开2.txt,乱码消失了!

    附:下面是iconv命令的参数列表

     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

    一般也就用到前四个

  • 相关阅读:
    @bzoj
    @bzoj
    @codeforces
    @codeforces
    @bzoj
    @codeforces
    @codeforces
    @codeforces
    @NOIP2018
    反转字符串--C和Python
  • 原文地址:https://www.cnblogs.com/savokiss/p/3936467.html
Copyright © 2011-2022 走看看