How could I downcase a non-English string in Ruby on Rails 3 ?
str = "Привет" # Russian puts str[0].ord # => 1055 str.downcase! puts str[0].ord # => 1055 (Should be 1087)
I want it to work in Ruby 1.8.7 as well as Ruby 1.9.2.
str = "Привет" str.mb_chars.downcase.to_s #=> "привет"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With