Sublime Text 2 supports GB2312 and GBK to solve the problem of garbled Chinese display

Source: Internet
Author: User
Tags sublime text

Sublime Text 2 is a very good source code and text editor, but does not support GB2312 and GBK encoding can be cumbersome in many cases. However, sublime Package control allows the plugin to allow sublime text 2 to almost perfectly support CJK-encoded text.

Installing sublime Package control is very simple, open the console with ctrl+~ on sublime Text 2 and enter the following code in it, or the code provided by the official. Sublime Text 2 automatically installs package control.

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 ('' +pf.replace ('), '%20 '). Read () );
print ' Please restart Sublime Text to finish installation '

If the method is not properly installed, you can also install it directly by copying the file. If sublime text 2 is installed in a Chinese-language path, or if the%username% of the system path contains characters, you may need to install them manually. Open the Preferences menu and select Browse Packages ... The system opens the Packages folder for Sublime Text 2, goes back to the previous level menu, and then opens the installed Packages folder to download and download the package Control.sublime-package Copy to Installed Packages folder (Note that this is installed Packages, not Packages folder) restart Sublime Text 2

Then use Ctrl+shift+p to open the command line mode, in which you can enter install package to search for the package. Generally use "ConvertToUTF8" and "GBK Encoding Support" to read and write the files in CJK format normally.

Similarly, if sublime text 2 is installed in a Chinese-language path, or if the%username% of the system path contains characters, you may need to manually install these package and copy them to the package directory.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.