• 文件名和文件内容编码转换


    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来查看.

  • 相关阅读:
    Day11作业
    day12作业
    samba共享服务
    PHP7 redis扩展安装
    linux lin命令
    PhpStorm,Pycharm,Goland破解
    PHP规范PSR2
    PHP 过滤器(Filter)
    Linux下Redis的安装与配置
    linux命令汇总
  • 原文地址:https://www.cnblogs.com/leipei2352/p/2077816.html
Copyright © 2020-2023  润新知