Sublime text 2 editor Chinese Question

Source: Internet
Author: User


Sublime text 2 is a very good source code and text editor, but does not support gb2312 and GBK encoding in many cases will be very troublesome. However, the sublime package control plug-in allows sublime text 2 to support CJK-encoded text almost perfectly.

 

Installing sublime package control is very simple. use Ctrl + ~ On sublime text 2 ~ Open the console and enter the following code in, or enter the official code (https://sublime.wbond.net/installation ). Sublime text 2 will automatically install package control.


1 import urllib2,os,hashlib; h = ‘7183a2d3e96f11eeadd761d777e62404‘ + ‘e330c659d4bb41d3bdf022e94cab3cd0‘; 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()) ); by = urllib2.urlopen( ‘http://sublime.wbond.net/‘ + pf.replace(‘ ‘, ‘%20‘)).read(); dh = hashlib.sha256(by).hexdigest(); open( os.path.join( ipp, pf), ‘wb‘ ).write(by) if dh == h else None; print(‘Error validating download (got %s instead of %s), please try manual install‘ % (dh, h) if dh != h else ‘Please restart Sublime Text to finish installation‘)

 

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

  1. Open the preferences menu and select Browse packages...
  2. The system will open the packages folder of sublime text 2, return to the upper menu, and then open the installed packages folder.
  3. Download and copy the downloaded package control. sublime-package to the installed packages folder (note that this is the installed packages, not the packages folder)
  4. Restart sublime text 2

 


Run Ctrl + Shift + P to open the command line mode, and enter install package to search for the required package. Generally, "converttoutf8" and "GBK encoding support" are used to read and write files in CJK format.


Similarly, if sublime text 2 is installed in a Chinese path or the % username % in the system path contains Chinese characters, you may need to manually install these packages, 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: 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.