sublime text 3 乱码

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+Pmac: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/

原文地址:https://www.cnblogs.com/fengtengfei/p/4136364.html