本來這個blog是記錄開發輸入法的點滴的,後來越來越雜,現在什麼都記錄了。

2013年1月4日 星期五

How to extract zip file which contains folders / filenames with CJK encoding in Ubuntu

Save the following in a file unzip.sh

#!/bin/bash

IFS=$'\n'
for i in $(LC_ALL=C 7z x -y "$1" | grep Extracting | sed -e "s/^Extracting  /.\//"); do
   mv  "$(echo "${i%/*}" | iconv -f GBK -t utf8)/${i##*/}"  "$(echo $i | iconv -f GBK -t utf8)"
done



then run:
sh ./unzip.sh filename.zip

(change filename.zip to the filename you needed)
(change to other encoding other than GBK)