Hi there,
Being a relatively happy Rails user I suddenly noticed that
string#capitalize and friends do not play well with international
characters well. Sample console session:
$ ./script/console
Loading development environment (Rails 2.2.3)
$KCODE
=> “UTF8”“ÑÂÌÏËÏ”.capitalize
=> “ÑÂÌÏËÏ”
Where “ñÂÌÏËÏ” was expected (Russian word for “Apple”).
I’ve googled for a workaround and found this:
“ÑÂÌÏËÏ”.mb_chars.capitalize.to_s
=> “ñÂÌÏËÏ”
but does it really need to be so ugly? Everyone else doing this?
I’m on Ubuntu 9.10 with Rails-2.2.3 and ruby-1.8.7.
–
Cheers,
Alex