2009年6月19日 星期五

關於來自windows中文zip壓縮檔的問題

通常我們要是收到來自windows端的中文壓縮zip文件,unzip後在ubuntu或b2dkgb等linux系統下都會呈現亂碼,並且使用linux的轉碼工具如convmv等,也都會失敗,推究其原因,其實是linux的unzip工具的問題,我有在網路上找到解答,作法如下
1.當我們使用linux原本的unzip,進行解壓時,解壓縮的檔案如下,你無法使用convmv轉換

2.修正unzip後,解開的結果如下(unzip windows壓縮文件.zip -d temp,把解開的目錄,放到temp目錄中)
修正的unzip,可到此下載:ftp://ftp3.tnc.edu.tw/KNOPPIX/health/kgubuntu/unzip
ps.修正的unzip的方法,如說明



3.安裝nautilus-filename-repairer套件,對新解開的檔案按右鍵,可以看到正確的中文檔名->rename as "windows中文壓縮檔",不過ubuntu9.04的這個套件有bug,當你按下rename as XXX,卻毫無反應,再ubuntu8.10時,是可正確進行轉換的,所以我們要借助convmv來轉換


4.安裝convmv後,執行以下的指令,可以遞迴的將目錄中的所有檔案進行轉碼
convmv -r --notest -f big5 -t utf-8 temp/
轉換成功,如下所示


5.若不想這麼麻煩,可以以wine安裝7z的windows軟體,用他來解壓縮即可

ps:unzip修正說明:

sudo apt-get source unzip

tar xzvf unzip_5.52.orig.tar.gz

cd unzip*

gedit unzpriv.h

把所有

*p = native((*p & 0×80) ? oem2iso[*p & 0×7f] : *p);}
改為
*p = native(*p);}

如下:

# ifdef CRTL_CP_IS_OEM
# ifndef IZ_ISO2OEM_ARRAY
# define IZ_ISO2OEM_ARRAY
# endif
# define _ISO_INTERN(str1) {register uch *p;\
for (p=(uch *)(str1); *p; p++)\
*p = native(*p);}
# else
# define _ISO_INTERN(str1) A_TO_N(str1)
# endif
#endif

#ifndef _OEM_INTERN
# ifdef CRTL_CP_IS_OEM
# define _OEM_INTERN(str1) A_TO_N(str1)
# else
# ifndef IZ_OEM2ISO_ARRAY
# define IZ_OEM2ISO_ARRAY
# endif
# define _OEM_INTERN(str1) {register uch *p;\
for (p=(uch *)(str1); *p; p++)\
*p = native(*p);}


make -f unix/Makefile generic



把新的unzip覆蓋/usr/bin/unzip即可

沒有留言:

blender:修改器Modifiers

  使用Modifiers:Array做出以下效果 plain axes(平面軸) \ Bevel(斜角) boolean