Created
August 23, 2011 15:16
-
-
Save jgwhite/1165397 to your computer and use it in GitHub Desktop.
A much smarter replacement for my old String#unaccent method. Credit goes to @GrahamAshton.
This file contains hidden or 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
| class String | |
| def asciify | |
| self.mb_chars.normalize(:kd).to_s | |
| end | |
| alias_method :unaccent, :asciify | |
| alias_method :remove_diacritics, :asciify | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment