Sublime Text 2 中文 GBK 规范的配置 暨 解决中文乱码问题 简述
首先通过 Package Control 安装 ConverToUTF8 插件,但是每次新建一个文本后并不是默认使用 GBK,要设置默认使用 GBK,请继续看,然后我们 Ctrl + O 打开文件,在目录 C:\Users\用户名\AppData\Roaming\Sublime Text 2\Packages\ConvertToUTF8 下找到 ConvertToUTF8.sublime-settings 文件,
{
// supported encoding list, name & code in pair
"encoding_list" : [
["Chinese Simplified (GBK)", "GBK"],
["Chinese Traditional (BIG5)", "BIG5"],
["Korean (EUC-KR)", "EUC-KR"],
["Japanese (CP932)", "CP932"],
["Japanese (Shift_JIS)", "Shift_JIS"],
["Japanese (EUC-JP)", "EUC-JP"],
["UTF-8", "UTF-8"]
],
// Maximum size for encoding cache, 0 means no cache
"max_cache_size" : 100,
// Maximum lines to detect, 0 means unlimited
"max_detect_lines" : 600,
// Convert when previewing file: true or false
"preview_action" : false,
// Encoding for new file, empty means using sublime text's "default_encoding" setting
"default_encoding_on_create" : "",
// Set this option to true will cause Sublime Text reload the saved file when losing focus
"lazy_reload": false,
// Convert in Find Results view
"convert_on_find": false,
// Convert when loading/saving a file
"convert_on_load" : true,
"convert_on_save" : true
}
注意突出标注的一行 "default_encoding_on_create" : "", 这里引号内是空的,只需要在 "" 内添加 GBK,即"default_encoding_on_create" : "GBK", 然后 Ctrl + S 保存即可。