Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

String Translit For Rails

DZone's Guide to

String Translit For Rails

·
Free Resource
// Translit for Rails using ActiveSupport. (convert é in e and other utf8 codes in latin chars)


class String
  def translit
    ActiveSupport::Multibyte::Handlers::UTF8Handler.normalize(self,:d).split(//u).reject { |e| e.length > 1 }.join
  end
end
Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}