標籤:style blog http ar color os 使用 sp 檔案
sublime text 是一款很好用的文字編輯軟體,可謂是程式員必備,但是最近發現在mac端使用的時候,中文亂碼,
網上一些解決方案,抄襲嚴重,沒有解決實際問題,所以記錄下自己解決問題的過程。
1、開啟Sublime Text 3,按windows:Ctrl+~;mac:control+~開啟控制行,複製粘貼以下python代碼,然後斷行符號運行。
import urllib.request,os,hashlib; h = ‘7183a2d3e96f11eeadd761d777e62404e330c659d4bb41d3bdf022e94cab3cd0‘; 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://sublime.wbond.net/‘ + 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)
2、重啟Sublime Text 3。
3、按windows:Ctrl+Shift+P;mac:command+shift+P開啟命令列,輸入Install Package,斷行符號,然後繼續輸入ConvertToUTF8,斷行符號。
可是安裝後開啟本地檔案還是錯誤。
原來是缺少Codecs,所以在此開啟命令列-->輸入Install Package-->Codecs,
重啟Sublime Text 3,開啟亂碼檔案 按下ctrl+shift+c
Darren
微博:@IT_攻城師
github:@Darren90
出處:http://www.cnblogs.com/fengtengfei/
sublime text 3 亂碼