Ubuntu unzip zip file scrambled code solution

  • 2020-05-13 04:22:50
  • OfStack

preface

This article introduces the solution of Ubuntu decompression zip file messy code, there are two ways to solve the problem, the following words do not say, to 1 look at it

1. Unzip the unzip line command to specify the character set


unzip -O CP936 xxx.zip ( with GBK, GB18030 Can also be )

Interestingly, there is no explanation for this option in manual of unzip. unzip --help has a simple one-line explanation for this parameter.

2. In environment variables, specify the unzip parameter and always display and extract files in the specified character set

Add 2 lines to /etc/environment


UNZIP="-O CP936"
ZIPINFO="-O CP936"

This way the Gnome desktop archive manager (file-roller) can extract Chinese using unzip normally, but file-roller itself cannot set the encoding to be passed to unzip.

summary

I used the second method first, but found that I didn't have file-roller installed, so I used the first method to specify the character set, and then I was done, but I still think the CP936... I don't know if there's a better way

conclusion


Related articles: