以下由sublime教學專欄為大家介紹讓SublimeText支援中文編碼的方法,希望對需要的朋友有幫助!
選單列–> 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
選單列–> Preference –> Package Control ,
輸入框內輸入”install package”, 點選下方自動提示出來的”install package”,
稍等幾秒後, 彈出一個小視窗, 輸入”CovertToUTF8”, 點選安裝.
稍等幾秒後, 插件即可安裝成功.
# 開啟先前中文亂碼的文件, 發現已經可以正確顯示了.
以上是如何設定讓SublimeText支援中文編碼的詳細內容。更多資訊請關注PHP中文網其他相關文章!