I’m trying to upgrade some tests as we move our app from Rails 2 on 1.8.7 to Rails 3 on Ruby 1.9.2. The tests basically ensure that database objects can be named with unicode characters, to provide international support.
The tests basically look like this:
#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
This is all fundamentally basic and very simplified for the purposes of posting here, but these are what fail. Is there anything else I need to be looking at here? I know Ruby doesn’t play well with Unicode, but this pretty much has to be left in. Any help is appreciated.
Looks like this is working as intended:
http://redmine.ruby-lang.org/issues/show/3181
Changed to ‘ä’ =~ /\p{L}/ got it to work.