下面由sublime教程欄目給大家介紹讓sublimetext支持中文編碼的方法,希望對需要的朋友有所幫助!
設置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(' ', ' ')).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(' ', ' ')).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”, 點擊安裝.
稍等幾秒后, 插件即可安裝成功.
打開之前中文亂碼的文檔, 發(fā)現(xiàn)已經可以正確顯示了.