网络营销电子商务研究中心  
How to buy the best prescription safety glasses in Canada? Let's study!
Go Back   网络营销电子商务研究中心 > 服务器与数据库 > Linux
User Name
Password
 
FAQ Members List Calendar Cheap Glasses

Reply
 
Thread Tools Display Modes
  #1   IP: 49.87.50.189
Old 2015-01-19, 05:15 AM
Ranson Ranson is offline
初级会员
 
Join Date: 2007-06-03
Posts: 1
Ranson 现在声名狼藉
Default Linux系统unzip解压后中文名乱码解决方法

解决办法一,利用pyton来处理

  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
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Prescription-glasses.com offers prescription glasses online at discount prices.
All times are GMT +8. The time now is 10:44 AM.


Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.