This project is archived and is in readonly mode.

#4595 ✓resolved
Norman Clarke

String.mb_chars.upcase doesn't upcase non-ASCII chars on with Ruby 1.9.x

Reported by Norman Clarke | May 14th, 2010 @ 08:08 PM | in 3.0.2

String#mb_chars does not currently return an instance of ActiveSupport::Multibyte::Chars under Ruby 1.9, leaving methods such as #upcase and #downcase up to Ruby 1.9's String class rather than a proxy.

At the time this code was developed, the assumption was that Ruby itself would provide this functionality in 1.9, so at the time the decision made perfect sense.

However, Matz has decided to leave UTF-8 case-folding out of Ruby 1.9, so there's currently no way to get UTF-8 aware upcasing/downcasing with Rails and Ruby 1.9:

Ruby 1.8.7:

"café".mb_chars.upcase # "CAFÉ"

Ruby 1.9.x

"café".mb_chars.upcase # "CAFé"

The patch I will attach makes AS use a proxy class on Ruby 1.9 to make the behavior consistent across Ruby versions. I also refactored all of AS's Unicode support into a new Unicode module to group related functionality and make it easier to reuse outside of ActiveSupport.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Pages