【发布时间】:2011-11-21 19:27:37
【问题描述】:
当我们将应用程序从 1.8.7 上的 Rails 2 迁移到 Ruby 1.9.2 上的 Rails 3 时,我正在尝试升级一些测试。测试基本确保数据库对象可以用 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 配合使用,但这几乎必须保留。感谢任何帮助。
【问题讨论】:
标签: ruby-on-rails unicode ruby-1.9