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

原文地址:https://www.cnblogs.com/keanuyaoo/p/3283621.html