Sublime Text 3 Chinese garbled code problem
Sublime Text 3
Sublime Text 3 is my favorite code editor, not one, because of its sexy highlight code color, but also because of its small size, but it does not support the coding format of GBK by default, so open the GBK code file, if there is Chinese in it, it will be garbled
one
If you download Sublime Text 3 from the official website, you need to install one first.
Package Control package, which is used to install other plug-ins. No matter what plug-ins are installed, you must install this package first.
two
Press the ctrl+~ shortcut key, call up a small text, and then paste the following code:
Import urllib.request,os,hashlib; h = '6f4c264a24d933ce70df5dedcf1dcaeeebe013ee18cced0ef93d5f746d80ef60; 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)
three
Restart Sublime Text 3 after installation, and there will be an extra Package Control under the perferences options column.
four
Click Package Control, there will be an input box above, we enter install, there will be automatic prompt for that install package, we click on install package, the input box will disappear, and another input box will pop up in a moment.
five
At this point, we can enter the plug-in package (ConvertToUTF8) we need to install.
six
After installing this package, restart Sublime Text 3 and you will find that the Chinese code in GBK format will not be garbled when it is opened.