Forum: Ruby on Rails Validating Umlauts

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Eec43f946d65be32e6b9fd2b3a1582a5?d=identicon&s=25 Adam Groves (addywaddy)
on 2006-01-10 09:34
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.
Eec43f946d65be32e6b9fd2b3a1582a5?d=identicon&s=25 Adam Groves (addywaddy)
on 2006-01-10 11:39
Adam Groves 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/HowToUseUn...
This topic is locked and can not be replied to.