Homeland Archlinux coffee-script 编译 app.coffee 的时候出错 [解决]

ichord · January 21, 2012 · 2441 hits

重点


问题

json 中文编码问题. 可能是因为 gnome3 本身就带有 js runtime. gjs. 也许这个 runtime 对中文编码支持不好.(猜测,能力有限不深究) parse 带有中文编码的 json 出错。

系统环境:
  • Archlinux + gnome3.2
  • ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]
  • javascript runtime: pacman -S js
解决

加个 js runtime. pacman -S nodejs


前言

前几天在 @tualatrix 的 blog 发现了 ruby china. 浏览一番。神奇的来兴致了。 偶然看到了一个关于 @mentions 的 issues. 更来兴致了。于是屁颠屁颠去实现和 weibo 一样的 @mentions 功能。基本实现了,没有测试兼容性。在这 https://github.com/chord--/At.js

错误发生过程

按照 ruby-china github 上的 README.markdown 的教程。 执行到了 rake assets:precompile 的时候出现 app/assets/javascripts/app.coffee 编译错误的提示。google 了一番没有结果。开始以为是 coffee-script 这个库有中文编码问题. 但在 irb 里编译出来又没有问题。后来再认真看,说的是 json parse 错误。 回头认真看了错误链,发现 coffee script 已经编译成功了!接着就是让 execjs 执行()., json parse 错误!后来去 execjs 看文档才知道它是选择系统的 js runtime。

原来是系统本身的 js runtime 对编码处理的问题。

No Reply at the moment.
You need to Sign in before reply, if you don't have an account, please Sign up first.