Validating Umlauts

Hi there,

I’m building a rails application for German and English speakers.
However, I’m having some problems validating German-specific characters
(äöü�). I have a tag-model which validates format of :name, :with =>
/^\w+$/. This throws an exception if german characters are used. My
tables are all utf-8 and my environment.rb has the lines

$KCODE = ‘u’
require ‘jcode’

to set the character set to utf-8. Funnily enough, if I comment out the
tag validation and add a new tag, an new row is created but the field
tags.name is blank if the name includes ä ö ü or �.

I’d be grateful if anyone could offer me some advice.

Adam G. wrote:

Hi there,

I’m building a rails application for German and English speakers.
However, I’m having some problems validating German-specific characters
(äöü�). I have a tag-model which validates format of :name, :with =>
/^\w+$/. This throws an exception if german characters are used. My
tables are all utf-8 and my environment.rb has the lines

$KCODE = ‘u’
require ‘jcode’

to set the character set to utf-8. Funnily enough, if I comment out the
tag validation and add a new tag, an new row is created but the field
tags.name is blank if the name includes ä ö ü or �.

I’d be grateful if anyone could offer me some advice.

Just found the solution:

http://wiki.rubyonrails.com/rails/pages/HowToUseUnicodeStrings