zoukankan      html  css  js  c++  java
  • 文件名和文件内容编码转换

    1.文件名的编码转换
        初始安装Solaris系统时,LANG的值设置为C,然后lambo用ftp将MR上传到服务器上去之后解压,结果就发现先前提到的很多bug的图片名称就变成了乱码了.因此从网上找到了convmv的方法.经过测试,这种方法是有效的.
            convmv -f gb2312 -t utf8 -r --notest ./*
                -r表示递归转换,包括子文件夹
                --notest 表示直接转换,不是只去做转换测试而不做真正转换
        以下是sunfreeware上对convmv的介绍:
        Convmv converts filenames (not file content), directories, and even whole filesystems to a different encoding - installs in /usr/local. Dependencies: perl in /usr/local/bin or you can edit the convmv file in /usr/local/bin and change the first line to point to the perl you want to use.
        需要注意的是,convmv安装好之后,如果系统里面的perl是自带的而非后面单独安装的,则需要修改convmv文件的第一行中的#!后面的shell解释器为`which perl`的值.

    2.文件内容的编码转换
        /bin/iconv -f fromencode -t toencode file
        要查看iconv支持的文件编码,可以用iconv -l来查看.

  • 相关阅读:
    Search a 2D Matrix
    binary search bug
    Find Minimum in Rotated Sorted Array II
    Search in Rotated Sorted Array 【新思路】
    Find Peak Element
    Find Minimum in Rotated Sorted Array
    DFS判断连通图
    分支限界法解决01背包问题
    python中ndarray和matrix
    python对数组缺失值进行填充
  • 原文地址:https://www.cnblogs.com/leipei2352/p/2077816.html
Copyright © 2011-2022 走看看