Skip to content

Instantly share code, notes, and snippets.

@jgwhite
Created August 23, 2011 15:16
Show Gist options
  • Select an option

  • Save jgwhite/1165397 to your computer and use it in GitHub Desktop.

Select an option

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.
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