首先我们要安装install package:
参考这里:
http://www.unicac.cn/share/Sublime-Package-Control.html
https://sublime.wbond.net/installation#st2
首先按键control + ~
输入:
import urllib2,os,hashlib; h = '7183a2d3e96f11eeadd761d777e62404' + 'e330c659d4bb41d3bdf022e94cab3cd0'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler()) ); by = urllib2.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); open( os.path.join( ipp, pf), 'wb' ).write(by) if dh == h else None; print('Error validating download (got %s instead of %s), please try manual install' % (dh, h) if dh != h else 'Please restart Sublime Text to finish installation')
然后我们shift+command+P,搜索install,会看见已经安装了:
我们进入install package,然后搜索我们想要的converttoutf8:
选择第一项,安装:
安装成功之后:
如果我们的文件是gbk的,我们需要再安装GBK Encoding Support :
之后我们打开文件,就会看见所有中文不再是乱码了~~~
另外需要说明一下,已经安装的插件就不会出现在install package的搜索项里了~~
再插一句,其中这句英文:
If for some reason the console installation instructions do not work for you (such as having a proxy on your network), perform the following steps to manually install Package Control:
- Click the menu
- Browse up a folder and then into the Installed Packages/folder
- Download Package Control.sublime-package and copy it into the Installed Packages/ directory
- Restart Sublime Text
其实这段的意思是当你shift+command+p的时候,也就是当你install packages不能正常显示的时候,教你怎么修复的,其中:
browse up a folder的意思,非常形象,也就是说当你执行了1步骤的时候,会弹出一个文件夹浏览框的意思,然后下载文件copy的这个文件夹,重启,然后你的install packages功能就会正常的意思~~~