Sublime Text 2 is a very good source code and text editor, but not supporting GB2312 and GBK encoding can be very cumbersome in many cases. The sublime package control, however, allows the plugin to allow sublime text 2 to support CJK encoded texts almost perfectly.
Installing the sublime package control is simple, open the console with ctrl+~ on sublime Text 2 and enter the following code in it, or the official code. Sublime Text 2 will automatically install the package Control.
[Python]View PlainCopy
- 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 ' Restart Sublime Text to finish installation '
If the method does not install correctly, you can also install it directly by copying the file. Manual installation may be required if sublime text 2 is installed in a Chinese-language path, or if the system path contains%username% characters.
- Open the Preferences menu and choose Browse Packages ...
- The system opens the sublime Text 2 packages folder, goes back to the previous level menu, and then opens the installed Packages folder
- Download and copy the downloaded package control.sublime-package to the installed Packages folder (Note that this is installed Packages, not the Packages folder)
- Restart Sublime Text 2
Then use Ctrl+shift+p to open the command-line mode and enter the install package inside to search for the package you need. It is common to use "ConvertToUTF8" and "GBK Encoding support" to read and write files in CJK format normally.
Similarly, if sublime text 2 is installed in a path with Chinese, or if the system path%username% contains Chinese characters, they may need to be manually installed and copied to the package directory.
Reproduced Sublime Text 2 support GB2312 and GBK, solve the problem of Chinese display garbled