解决Mac下SublimeLinter的Unsafe Characters警告

Mac下编辑JS文件, 如果是中文字符的行会警告: This character may get silently deleted by one or more browsers.

SublimeLinter 的官方文档http://goo.gl/VYzZ0, 里面也说的含糊不清, 只是告诉要装nodejs或设置sublimelinter_executable_map.
On Mac OS X, you must install Node.js if you plan to edit Javascript or CSS files that use non-ASCII characters in strings or comments, because JavaScriptCore is not Unicode-aware.
OS X默认的JavaScriptCore(jsc)不支持非ASCII字符, 所以会报上面的警告, 使用nodejs才行.

debug了下SublimeLinter的源码, 发现把Package Settings->SublimeLinter->Settings - User加上:
"sublimelinter_executable_map":
{
"javascript": "/Users/leon/.nvm/v0.10.8/bin/node" // which node
},
就OK了, 开始还以为要设置"node":"node path", 原来是设置"javascript"..

没安装nodejs到/usr/local/bin, 如果使用其他编辑器里的jshint/jslint应该也会遇到这个警告, 可以尝试修改node路径来解决.

posted @ 2013-09-19 13:30  zhepama  阅读(479)  评论(0编辑  收藏  举报