设置sublimetext支持中文编码1. 安装 package control菜单栏 –> view –> show console
如果是sublimetext3, 那么复制下面一段话粘贴到console中:
import urllib.request,os,hashlib; h = '6f4c264a24d933ce70df5dedcf1dcaee' + 'ebe013ee18cced0ef93d5f746d80ef60'; pf = 'package control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.proxyhandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)
如果是sublimetext2, 那么复制下面一段话粘贴到console中:
import urllib2,os,hashlib; h = '6f4c264a24d933ce70df5dedcf1dcaee' + 'ebe013ee18cced0ef93d5f746d80ef60'; 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://packagecontrol.io/' + 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')
以上代码请参考网址: https://packagecontrol.io/installation
2.安装converttoutf8插件菜单栏 –> preference –> package control,
输入框内输入”install package”, 点击下方自动提示出来的”install package”,
稍等几秒后, 弹出一个小窗口, 输入”coverttoutf8”, 点击安装.
稍等几秒后, 插件即可安装成功.
打开之前中文乱码的文档, 发现已经可以正确显示了.
以上就是如何设置让sublimetext支持中文编码的详细内容。