菜鸟lei的学习成长空间

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

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

posted on 2011-06-10 17:14  菜鸟-雷  阅读(523)  评论(0编辑  收藏  举报