原来unzip有个-O参数,可以设定编码的。到了6.0版本不知为何移除了。后来ZIP乱码问题就一直困扰着群众。
今天翻了翻官网,发现测试版本6.10b重新添加了这个参数:
- Add -I and -O options for setting ISO and OEM character sets, respectively, used by UnZip when doing character set translations. This support is based on the unzip60-alt-iconv-utf8 patch suggested in an Info-ZIP forum thread and uses the iconv library which must be available. These options are enabled using the USE_ICONV_MAPPING compiler macro. Suggestions welcome on how to improve this limited character translation support.
虽然这个版本2010年底就发布了,但能搜索到的信息几乎没有,真是奇怪。用官方新版本解决乱码不是很方便么……
于是写了个PKGBUILD,扔AUR了: unzip-beta
使用示例:
unzip 我是一个ZIP.zip -Ogbk