`
arkxu
  • 浏览: 42693 次
  • 性别: Icon_minigender_1
  • 来自: 上海
文章分类
社区版块
存档分类
最新评论

让 ruby 1.9.1 + rails 2.3.3 + mysql 完美工作

阅读更多
ruby1.9 String中加入的encoding确实有点又疼。导致rails总是会出现:

incompatible character encodings: UTF-8 and ASCII-8BIT
or
incompatible character encodings: ASCII-8BIT and UTF-8

主要原因有两个,一个是actionview总是用ascii-8bit去解析string, 另一个在于数据库适配器现在还不是encoding aware的。如果是utf8的db那问题就来了。

就这个问题,对于rails团队有些绝望。都这么久了,问题还是没有解决。encoding问题并不是rails绝无仅有遇到的问题,此问题早就有解,为什么不做在rails 2.3.3的release里?

无奈只能山寨了,山寨的东西肯定没有原厂的好,将就着吧。

解决这个问题需要hack rails 2.3.3的几处代码, 同时使用一个新的mysql-ruby adapter.

步骤:

1. Make partial rendering enforces a utf-8

2. Make TextHelper concat always deals with

3. Make upload mutiparts work.(rake utils.rb binary encoding problem)
http://github.com/rack/rack/commit/44ed4640f077504a49b7f1cabf8d6ad7a13f6441

4. Install a new mysql adapter
http://github.com/hectoregm/mysql-ruby/tree/master

前两个path file 我都放在附件里。

更多我的博客请看:  http://arkxu.com
4
0
分享到:
评论
1 楼 易卡螺丝君 2010-07-01  
2.3.5已经fix了

相关推荐

Global site tag (gtag.js) - Google Analytics