Sublime Text Chinese garbled

The GBK encoding format is not supported by default, so if you open the GBK code file, if there is Chinese in it, it will be garbled.

1. Open the console: View-->show console or shortcut key ctrl+~


2. Copy line by line to the console for execution

<span style="font-size:18px;">import urllib2,os;  
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()));  
open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read());  
print 'Please restart Sublime Text to finish installation'  </span>
<span style="font-size:18px;">
</span>

If this method cannot be installed correctly, you can also directly install it by copying files. If Sublime Text 2 is installed in a path with Chinese, or if the %username% of the system path contains Chinese characters, you may need to install it manually.

Manual installation
Open the Preferences menu and select Browse Packages... The
system will open the Packages folder of Sublime Text 2, return to the previous menu, and then open the Installed Packages folder.
Download and copy the downloaded Package Control.sublime-package to Installed Packages Folder (note that this is Installed Packages, not Packages folder)
restart Sublime Text 2


3. Preferences-->package control and enter Install Package in it to search for the required Package.


Click it and wait a while and it will be installed

4. Install ConvertToUTF8

Ctrl+Shift+P opens the command line mode , and enter ConvertToUTF8 in it. Click it in the found list.

ps: here because I have installed it, there is no display list

Similarly, if Sublime Text 2 is installed in a path with Chinese, or if the %username% of the system path contains Chinese characters, you may need to manually install these Packages and copy them to the Package directory


5. Wait for restart

Guess you like

Origin blog.csdn.net/hgz_gs/article/details/52164047