2011-11-21 64 views
2

我试图升级一些测试,因为我们将应用程序从1.8.7的Rails 2移动到Ruby 1.9.2的Rails 3。测试基本上确保数据库对象可以用unicode字符命名,以提供国际支持。Ruby 1.9,Rails 3和Unicode:代码将无法识别Unicode字符

测试基本上是这样的:

#encoding: utf-8 
'ä' =~ /\S/ # this passes 
'ä' =~ \/w/ # this fails, apparently passed on 1.8.7 
model = Model.create!(:name => '§äè®') # this causes a "Name must include at least one letter or number" validation error, which means Ruby (or Rails) is seeing the name as being blank 

这一切根本基础和非常简化了张贴在这里的目的,但这些都是失败。还有什么我需要在这里看?我知道Ruby不能很好地使用Unicode,但这几乎必须留在。任何帮助表示赞赏。

回答