Sublime Text 技巧:支持GBK编码

我的操作方式是基于Mac下的OS X系统
按Command + Shift + P打开万能搜索框,然后输入install package回车(第一次打开需要重启应用),看到列表之后再输入ConvertToUTF8回车,就会下载安装这个包了。装好之后会看到这个包的说明文件,如下图。

ConvertToUTF8
-------------

  ConvertToUTF8
  ==================
  With this plugin, you can edit and save the files which encodings are not supported by Sublime Text currently, especially for those used by CJK users, such as GB2312, GBK, BIG5, EUC-KR, EUC-JP, etc.

  Configuration
  ------------------
  Please check ConvertToUTF8.sublime-settings file for details. You should save your personal settings in a file named "ConvertToUTF8.sublime-settings" under "User" folder.

  * encoding_list: encoding selection list when detection is failed
  * max_cache_size: maximum encoding cache size, 0 means no cache (default: 100)
  * max_detect_lines: maximum detection lines, 0 means unlimited (default: 600)
  * preview_action: converting the file's content to UTF-8 when previewing it (default: false)
  * default_encoding_on_create: specific the default encoding for newly created file (such as "GBK"), empty value means using sublime text's "default_encoding" setting (default: '')
  * convert_on_load: convert the file's content to UTF-8 when it is loaded (default: true)
  * convert_on_save: convert the file's content from UTF-8 to its original (or specific) encoding when it is saved (default: true)
  * convert_on_find: convert the text in Find Results view to UTF-8 (default: false)
  * lazy_reload: save file to a temporary location, and reload it in background when switching to other windows or tabs (default: false)

  Contact me
  ------------------
  Please send me your questions or suggestions: sunlxy (at) yahoo.com or http://weibo.com/seanliang

  For more information, please visit: https://github.com/seanliang/ConvertToUTF8

再次打开文件依旧乱码提示

Encoding: GB2312
Error: Codecs missing
Please install Codecs33 plugin (https://github.com/seanliang/Codecs33/tree/osx).

原因是
由于 Sublime Text 内嵌的 Python 限制,ConvertToUTF8 可能无法正常工作。
解决方法:
再次按Command + Shift + P打开万能搜索框,然后输入install package回车。看到列表之后再输入Codecs33回车

安装成功后,正常打开GBK编码文件

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

一行注释也不写

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值