Mac os solve sublime Text2 or 3 Chinese garbled problem

Source: Internet
Author: User
Tags sublime text



Degrees Niang for a long time have not found Mac OS solve sublime Text2 Chinese garbled problem of the tutorial,






So I thought for a while, studied and successfully in the Mac OS directly with the sublime Text2 open Chinese-language files.






(No need to open a DOS platform every time you have to go to Xcode to turn a code or something ...) )






The steps are as follows:



0. Open Sublime Text



1. control+ ' ~ ' to open the console,



Enter the command according to sublime package control, according to this website (https://sublime.wbond.net/installation#st2)



If it is sublime text3, it is as follows:



import urllib.request,os,hashlib; 
h = '7183a2d3e96f11eeadd761d777e62404' + 'e330c659d4bb41d3bdf022e94cab3cd0'; 
pf = 'Package Control.sublime-package'; 
ipp = sublime.installed_packages_path();
 urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); 
by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); 
dh = hashlib.sha256(by).hexdigest(); 
print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)





If it is sublime text2, it is as follows:




Import Urllib.request,os,hashlib; 
h = ' 7183a2d3e96f11eeadd761d777e62404 ' + ' e330c659d4bb41d3bdf022e94cab3cd0 '; 
PF = ' package control.sublime-package '; 
IPP = Sublime.installed_packages_path (); 
Urllib.request.install_opener (Urllib.request.build_opener (Urllib.request.ProxyHandler ())); 
by = Urllib.request.urlopen (' http://packagecontrol.io/' + pf.replace (', '%20 ')). read (); 
DH = hashlib.sha256 (by). Hexdigest (); 
Print (' Error validating download (got%s instead of%s), please try manual install '% (DH, h)) if DH! = H Else Open (Os.pat H.join (IPP, PF), ' WB '). Write (by)







2. Enter the installation complete, restart sublime TEXT2/3



3. command+shift+p, open the Package control command line that you just installed



4. Enter the Install package



5. When it is loaded into the package directory, enter "ConvertToUTF8" or "GBK Encoding support" and then return to install



6. After installing the restart sublime Text2, you can see the beautiful Chinese characters appear!






Mac os solve sublime Text2 or 3 Chinese garbled problem


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.