This project is archived and is in readonly mode.
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
-
Norman Clarke May 14th, 2010 @ 08:10 PM
- Tag changed from ruby 1.9.1, activesupport, multibyte to ruby 1.9.1, activesupport, multibyte, patch
Patch attached.
-
Jeremy Kemper May 21st, 2010 @ 06:36 PM
- Milestone cleared.
- State changed from new to open
Nice. Could you rebase against master?
-
Jeremy Kemper May 21st, 2010 @ 08:43 PM
- State changed from open to resolved
-
Jeremy Kemper October 15th, 2010 @ 11:01 PM
- Milestone set to 3.0.2
- Importance changed from to Low
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>