On Sat, May 8, 2010 at 16:31, Rodrigo Rosenfeld Rosas <[email protected]> wrote: > Em 08-05-2010 15:56, Mateo Murphy escreveu: >> >> On 8-May-10, at 1:31 PM, Norman Clarke wrote: >> >>> If it's true that there are no plans to add UTF-8 case-folding to Ruby >>> 1.9 then I think it would be a good idea. I've been working on >>> multibyte a bit lately and would be happy to work on it some more if >>> folks think it would be useful. >> >> I'd say that developing this as part of the I18n gem or even standalone >> would be better than as part of rails, as it would be very useful outside of >> rails, and not everybody who uses rails would need this functionality. >> >> > I agree that writing this in I18n or a standalone library would probably be > better because of you first argument, but not for the last one... > > Rails has an approach different from Merb or Sinatra in the way it is a > full-stack framework. I believe multibyte support would be more useful for > most people than REST support, for instance... > > But since AS is also an independent library and could be used outside Rails > too, I don't see any problems in patching String in AS... But I think it > would be cleaner if it was an independent library that could be used inside > I18n or AS gem...
These two libraries provide pretty good support for UTF-8 manipulation: http://github.com/blackwinter/unicode http://github.com/lang/unicode_utils Yoshida Masato's is written in C and provides good performance, while Stefan Lang's is written in Ruby and also appears to provide support for proper UTF-8 case folding, so there's probably no need to duplicate the effort of adding that to AS; it should be easy enough to just implement proxy classes that use them, and make AS use them in place of its default proxy class: ActiveSupport::Multibyte.proxy_class = PutativeUnicodeProxyClass ActiveSupport::Multibyte.proxy_class = PutativeUnicodeUtilsProxyClass But I do think that Rails should still provide decent support for case folding, and the behavior of commonly-used things like #upcase and #downcase should not change so dramatically when you use Ruby 1.9 vs 1.8. It would be pretty simple to extract some methods from Multibyte::Chars into a module that can be shared between the current feature-rich proxy class for 1.8 and a thinner one for 1.9. -Norman -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" 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-core?hl=en.
