linux下zip文件解压后乱码解决方案
2016-02-03 15:50
555 查看
解决办法一,利用pyton来处理
1.vi uzip文件
2.复制一下内容(Python)
3.chmod +x uzip
4../uzip xxxx.zip
方法2,通过unzip行命令解压,指定字符集(推荐使用)
有趣的是unzip的manual中并无这个选项的说明,unzip –help对这个参数有一行简单的说明。
方法3,在环境变量中,指定unzip参数,总是以指定的字符集显示和解压文件
/etc/environment中加入2行
UNZIP=”-O CP936″
ZIPINFO=”-O CP936″
方法4,采用java的jar命令解压zip包 JAR 解压
jar xvf file.name
1.vi uzip文件
2.复制一下内容(Python)
#!/usr/bin/env python # -*- coding: utf-8 -*- # uzip.py import os import sys import zipfile print "Processing File " + sys.argv[1] file=zipfile.ZipFile(sys.argv[1],"r"); for name in file.namelist(): utf8name=name.decode('gbk') print "Extracting " + utf8name pathname = os.path.dirname(utf8name) if not os.path.exists(pathname) and pathname!= "": os.makedirs(pathname) data = file.read(name) if not os.path.exists(utf8name): fo = open(utf8name, "w") fo.write(data) fo.close file.close()
3.chmod +x uzip
4../uzip xxxx.zip
方法2,通过unzip行命令解压,指定字符集(推荐使用)
unzip -O CP936 xxx.zip (用GBK, GB18030也可以)
有趣的是unzip的manual中并无这个选项的说明,unzip –help对这个参数有一行简单的说明。
方法3,在环境变量中,指定unzip参数,总是以指定的字符集显示和解压文件
/etc/environment中加入2行
UNZIP=”-O CP936″
ZIPINFO=”-O CP936″
方法4,采用java的jar命令解压zip包 JAR 解压
jar xvf file.name
相关文章推荐
- linux系统上安装paramiko模块
- Linux常用指令---ssh/scp
- Using TurboVNC 0.6 and VirtualGL 2.1.4 to run OpenGL Application Remotely on CentOS
- Linux流量监控工具 - iftop (最全面的iftop教程)
- linux 命令
- linux查看磁盘空间命令
- linux ./configure 的参数详解
- centos开机优化
- linux常用基本命令
- 搭建Pxe服务器无人听应答全自动安装CentOS6.7系统 推荐
- linux国外视频网站,这个网站真的很厉害,Linux基金会
- linux下的软件安装
- linux tail指令
- 一个比红帽还酷炫的Linux国际认证考试-Linux权威认证
- linux如何查看命令对于的是哪个软件包&linux排错思路
- linux的挂载的问题,重启后就挂载就没有了
- 【Linux学习011】sed命令详解
- Linux cheat命令
- 关于Linux开源项目基础组件make编译流程
- Git的安装和使用(Linux)【转】