On Mar 18, 1:12 pm, Alex Shulgin
<alex.shul...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> 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.
Sadly, google groups scrambled the symbols, but take my word -- it
doesn''t work with plain capitalize, but works only through mb_chars.
Am I doing something wrong? Can I (should I) monkey-patch String
class to pipe capitalize et al. through mb_chars?
--
Regards,
Alex
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.