Hi, I''m pretty sure to have seen a new method ''remove_accents'' in Rails 2.2 but I can''t find it again. Is it me or does this method exists for good ? Thanks -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Bob, I don''t know about such a method, but I hope it exists. In the mean time, I''ve tried one I found on this same forum (in French: http://www.ruby-forum.com/topic/144612#784212). Unfortunately, it doesn''t work when I run my application, but it works in irb! I suspect it''s got to do with encoding... def ApplicationHelper.remove_accents( str ) accents = { [''á'',''à'',''â'',''ä'',''ã'',''Ã'',''Ä'',''Â'',''À''] => ''a'', [''é'',''è'',''ê'',''ë'',''Ë'',''É'',''È'',''Ê''] => ''e'', [''í'',''ì'',''î'',''ï'',''I'',''Î'',''Ì''] => ''i'', [''ó'',''ò'',''ô'',''ö'',''õ'',''Õ'',''Ö'',''Ô'',''Ò''] => ''o'', [''œ''] => ''oe'', [''ß''] => ''ss'', [''ú'',''ù'',''û'',''ü'',''U'',''Û'',''Ù''] => ''u'' } accents.each do |ac,rep| ac.each do |s| str.gsub!(s, rep) end end return str end I tried setting $KCODE="UTF-8" or $KCODE="ISO-8859-1" at the top of my source code, as suggested by cwilliams (creator of RadRails: http://forums.aptana.com/viewtopic.php?f=20&t=8234), but that doesn''t solve my problem. If you get this working in a real application, please let me know; I''m getting desparate! Thanks, Chris. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Here''s another solution: http://www.techniconseils.ca/en/scripts-remove-accents-ruby.php Unfortunately, I still have the same encoding problems, but hopefully it''ll work for you. And don''t hesitate to get back to me if you think you know what I''m doing wrong :) Good luck, Chris. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Bob, Rails doesn''t have a specific method to remove diacritics. There are a couple alternatives - I used the 1st one and it works really great: + http://snippets.dzone.com/posts/show/5609 + http://github.com/thbar/diacritics_fu/tree/master + http://www.jroller.com/obie/tags/ruby + http://www.techniconseils.ca/en/scripts-remove-accents-ruby.php Cheers, Sazima On Feb 20, 7:24 am, Chris Gers32 <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Here''s another solution: > > http://www.techniconseils.ca/en/scripts-remove-accents-ruby.php > > Unfortunately, I still have the same encoding problems, but hopefully > it''ll work for you. And don''t hesitate to get back to me if you think > you know what I''m doing wrong :) > > Good luck, > > Chris. > -- > Posted viahttp://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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> I used the 1st one and it works really great: > > + http://snippets.dzone.com/posts/show/5609I tried that, but I get the following error message: NameError: uninitialized constant ActiveSupport::Multibyte::Handlers I have Ruby 1.8.6 and Rails 2.2.2. Thanks, Chris. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---