百度网盘打包下载后是pack.zip,如果下载的内容是中文的话,直接用zip解压是会出现乱码
[t@bjb0541 ~]$ unzip pack.zip
Archive:  pack.zip
   creating: -?+?/TCP-IP???/
 extracting: -?+?/TCP-IP???/TCP-IP????2??-???.pdf  
 extracting: -?+?/TCP-IP???/TCP-IP????1??????.pdf  
 extracting: -?+?/TCP-IP???/TCP-IP????3??TCP--+?????.pdf  
[t@bjb0541 ~]$ ^C
[t@bjb0541 ~]$  cd /home/talen/-?+?
bash: cd: /home/talen/-?+?: No such file or directory

[t@bjb0541 ~]$ ls -l
...
2621858 drwx------. 3 t t     4096 Mar 23 16:07 ?鼮


下面是解决方法:
创建/tmp/a目录,在此目录下解决文件.创建此目录的目的是减少第二步搜索的范围.
[t@bjb0541 ~]$ cd /tmp/a/
[t@bjb0541 a]$ LANG=C ; 7z x /home/talen/pack.zip

7-Zip [64] 15.09 beta : Copyright (c) 1999-2015 Igor Pavlov : 2015-10-16
p7zip Version 15.09 beta (locale=C,Utf16=off,HugeFiles=on,64 bits,4 CPUs Intel(R) Core(TM) i3 CPU       M 380  @ 2.53GHz (20655),ASM)

Scanning the drive for archives:
1 file, 54796877 bytes (53 MiB)

Extracting archive: /home/talen/pack.zip
--         
Path = /home/talen/pack.zip
Type = zip
Physical Size = 54796877

执行convmv -f GBK -t utf8 --notest -r .
[t@bjb0541 a]$ convmv -f GBK -t utf8 --notest -r .
mv "./?鼮/TCP-IP????/TCP-IP??????3??TCP????Э??.pdf"     "./?鼮/TCP-IP????/TCP-IP详解卷3:TCP事务协议.pdf"
mv "./?鼮/TCP-IP????/TCP-IP??????1??Э??.pdf"    "./?鼮/TCP-IP????/TCP-IP详解卷1:协议.pdf"
mv "./?鼮/TCP-IP????/TCP-IP??????2?????.pdf"    "./?鼮/TCP-IP????/TCP-IP详解卷2:实现.pdf"
mv "./?鼮/TCP-IP????"   "./?鼮/TCP-IP详解"
mv "./?鼮"      "./书籍"
Ready! I converted 5 files in 0 seconds.
可以看到非常完美.
windows下打包的ZIP包在LINUX下中文内容乱码解决-LMLPHP
有一些包7z可能解压出来是0字节,可以试下python脚本:

点击(此处)折叠或打开

  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import os
  4. import sys
  5. import zipfile
  6. #print "Processing File " + sys.argv[1]
  7. file=zipfile.ZipFile(sys.argv[1],"r");
  8. for name in file.namelist():
  9.     utf8name=name.decode('gbk')
  10. # print "Extracting " + utf8name
  11.     pathname = os.path.dirname(utf8name)
  12.     if not os.path.exists(pathname) and "":
  13.         os.makedirs(pathname)
  14.     data = file.read(name)
  15.     if not os.path.exists(utf8name):
  16.         fo = open(utf8name, "w")
  17.         fo.write(data)
  18.         fo.close
  19. file.close()

  20. #作者:Latm Ake
  21. #链接:http://www.zhihu.com/question/20523036/answer/35225920
  22. #来源:知乎
  23. #著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。


参考:http://www.zhihu.com/question/20523036
02-02 08:28