Reproduced Sublime Text 2 support GB2312 and GBK, solve the problem of Chinese display garbled

Source: Internet
Author: User

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
  1. Import Urllib2,os;
  2. pf=' package control.sublime-package ';
  3. Ipp=sublime.installed_packages_path ();
  4. Os.makedirs (IPP) if not os.path.exists (IPP) else None;
  5. Urllib2.install_opener (Urllib2.build_opener (urllib2. Proxyhandler ()));
  6. Open (Os.path.join (IPP,PF),' WB '). Write (Urllib2.urlopen ('http://sublime.wbond.net/' +pf.replace ('), '%20 ').  Read ());
  7. 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.

    1. Open the Preferences menu and choose Browse Packages ...
    2. The system opens the sublime Text 2 packages folder, goes back to the previous level menu, and then opens the installed Packages folder
    3. Download and copy the downloaded package control.sublime-package to the installed Packages folder (Note that this is installed Packages, not the Packages folder)
    4. 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

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: info-contact@alibabacloud.com 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.