utf-8中文在source insight中顯示爲亂碼,寫了一個簡單腳本,在linux下將代碼轉換爲GBK格式,然後在source insight下正常查看。
#!/bin/sh
function conv() {
echo "Converting $1"
enca -L zh_CN -x GBK $1
}
function walk() {
for file in `ls $1`
do
if [ -d $1"/"$file ]
then
walk $1"/"$file
else
conv $1"/"$file
fi
done
}
walk $1
保存爲conv.sh 使用方法 ./conv.sh dir