So, I’ve been pounding the web for info on UTF8 in Ruby and Rails the
past couple days to concoct some validations that allow UTF8
characters. I have discovered that with the patches applied in Rails
1.2, I can get a little further by doing the following declaring
$KCODE = ‘UTF8’ in environment.rb and by adding /u to regex expressions.
The only thing not working now is the ability to define a range of \x
characters in a regex.
So, this /^[a-zA-Z\xE4]*?&/u will validate that a string is allowed
to have an ä in it. Perfect.
But… this fails /^[a-zA-Z\xE4-\xE6]*?&/u
But… this works /^[a-zA-Z\xE4\xE5\xE6]*?&/u
I’ve boiled the experiments down to realizing I can’t define a range
with \x
Is this just one of those things that just doesn’t work yet WRT Ruby/
Rails/UTF8, or is there another syntax? I’ve scoured all the regex
docs I can find.
–
def gw
acts_as_n00b
writes_at(www.railsdev.ws)
end