签到成功

知道了

CNDBA社区CNDBA社区

Linux unzip 解压缩 中文乱码 解决方法

2021-08-04 10:26 220 0 原创 Linux
作者: dave

1 问题描述

压缩包里包含中文,在Linux 直接解压缩中文会乱码:https://www.cndba.cn/dave/article/4643https://www.cndba.cn/dave/article/4643

https://www.cndba.cn/dave/article/4643
https://www.cndba.cn/dave/article/4643

[dave@www.cndba.cn  data]# unzip tdsql.zip
Archive:  tdsql.zip
   creating: tdsql/
   creating: tdsql/poc▓т╩╘╣д╛▀/
  inflating: tdsql/poc▓т╩╘╣д╛▀/sysbench-master.tgz
  inflating: tdsql/poc▓т╩╘╣д╛▀/tpcc_groupshard.tgz
   creating: tdsql/tdsql░▓╫░▓┐╩Ё░№/
  inflating: tdsql/tdsql░▓╫░▓┐╩Ё░№/TDSQL▓·╞╖▓┐╩Ё╬─╡╡10.3.14.1.0_20200103.doc
  inflating: tdsql/tdsql░▓╫░▓┐╩Ё░№/tdsql_full_install_ansible_10.3.14.1.0_D002.zip


   creating: tdsql/╫щ╝■╔¤╝╢░№/
  inflating: tdsql/╫щ╝■╔¤╝╢░№/update-db-node.zip



   creating: tdsql/│р═├░ц▒╛╔¤╝╢░№/
  inflating: tdsql/│р═├░ц▒╛╔¤╝╢░№/tdsqlpcloud.zip
[dave@www.cndba.cn  data]#

2 解决方法

[dave@www.cndba.cn  data]# unzip -h
UnZip 6.00 of 20 April 2009, by Info-ZIP.  Maintained by C. Spieler.  Send
bug reports using http://www.info-zip.org/zip-bug.html; see README for details.

Usage: unzip [-Z] [-opts[modifiers]] file[.zip] [list] [-x xlist] [-d exdir]
  Default action is to extract files in list, except those in xlist, to exdir;
  file[.zip] may be a wildcard.  -Z => ZipInfo mode ("unzip -Z" for usage).

  -p  extract files to pipe, no messages     -l  list files (short format)
  -f  freshen existing files, create none    -t  test compressed archive data
  -u  update files, create if necessary      -z  display archive comment only
  -v  list verbosely/show version info       -T  timestamp archive to latest
  -x  exclude files that follow (in xlist)   -d  extract files into exdir
modifiers:
  -n  never overwrite existing files         -q  quiet mode (-qq => quieter)
  -o  overwrite files WITHOUT prompting      -a  auto-convert any text files
  -j  junk paths (do not make directories)   -aa treat ALL files as text
  -U  use escapes for all non-ASCII Unicode  -UU ignore any Unicode fields
  -C  match filenames case-insensitively     -L  make (some) names lowercase
  -X  restore UID/GID info                   -V  retain VMS version numbers
  -K  keep setuid/setgid/tacky permissions   -M  pipe through "more" pager
  -O CHARSET  specify a character encoding for DOS, Windows and OS/2 archives
  -I CHARSET  specify a character encoding for UNIX and other archives

See "unzip -hh" or unzip.txt for more help.  Examples:
  unzip data1 -x joe   => extract all files except joe from zipfile data1.zip
  unzip -p foo | more  => send contents of foo.zip via pipe into program more
  unzip -fo foo ReadMe => quietly replace existing ReadMe if archive file newer
[dave@www.cndba.cn  data]#

在帮助里可以看到有-O 参数,可以指定字符集来解压缩:

https://www.cndba.cn/dave/article/4643
https://www.cndba.cn/dave/article/4643https://www.cndba.cn/dave/article/4643
https://www.cndba.cn/dave/article/4643
https://www.cndba.cn/dave/article/4643
https://www.cndba.cn/dave/article/4643

[dave@www.cndba.cn  data]# unzip -O GBK tdsql.zip
Archive:  tdsql.zip
   creating: tdsql/
   creating: tdsql/poc测试工具/
  inflating: tdsql/poc测试工具/sysbench-master.tgz
  inflating: tdsql/poc测试工具/tpcc_groupshard.tgz
  ……
[dave@www.cndba.cn  data]#

版权声明:本文为博主原创文章,未经博主允许不得转载。

用户评论
* 以下用户言论只代表其个人观点,不代表CNDBA社区的观点或立场
dave

dave

关注

人的一生应该是这样度过的:当他回首往事的时候,他不会因为虚度年华而悔恨,也不会因为碌碌无为而羞耻;这样,在临死的时候,他就能够说:“我的整个生命和全部精力,都已经献给世界上最壮丽的事业....."

  • 1906
    原创
  • 2
    翻译
  • 463
    转载
  • 137
    评论
  • 访问:3864995次
  • 积分:3159
  • 等级:核心会员
  • 排名:第1名
精华文章
    最新问题
    查看更多+
    热门文章
      热门用户
      推荐用户
        Copyright © 2016 All Rights Reserved. Powered by ZhiXinTech · 皖ICP备19020168号·

        QQ交流群