source insight 下看不了utf-8中文字符

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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章