Created
February 17, 2009 08:15
-
-
Save ecarnevale/65633 to your computer and use it in GitHub Desktop.
Translit for Rails using ActiveSupport. (convert é in e and other utf8 codes in latin chars)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# from http://snippets.dzone.com/posts/show/5609 | |
class String | |
def translit | |
ActiveSupport::Multibyte::Handlers::UTF8Handler.normalize(self,:d).split(//u).reject { |e| e.length > 1 }.join | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Other solutions by Obie Fernandez: http://www.jroller.com/obie/tags/unicode |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment