pharrington wrote:
> .......
>
> Anyway, by default Rails will set the encoding to UTF8 (just put
> Rails.logger.debug "Kcode: #{$KCODE}" to confirm this is the case for
> you). To see what encoding *is* working properly, just check the
> $KCODE global from irb. Then set that accordingly in your
> environment.rb and restart your app.
Setting $KCODE to "u" in a ruby program is not a cure all. Not all the
ruby methods will suddenly recognize that characters consist of
multi-bytes. For instance,
$KCODE = "n"
str = "лошадь"
puts str.length
$KCODE = "u"
puts str.length
--output:--
12
12
If $KCODE were a cure all, they(Matz, et al) would just switch it on in
permanently, and the unicode problems would disappear.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---