module Sterile
def transliterate(string, options = {})
"ýůçký".transliterate # => "yucky"
of more pedantic matches.
Passing an option of :optical => true will prefer optical mapping instead
by Eric Boehs at https://github.com/ericboehs/to_slug
superior results to iconv. The optical conversion data is based on work
which is in turn a port of Perl's Unidecode and ostensibly provides
ASCII equivalents. This is based on data from the stringex gem (https://github.com/rsl/stringex)
Transliterate Unicode [and accented ASCII] characters to their plain-text
def transliterate(string, options = {}) options = { :optical => false }.merge!(options) if options[:optical] transmogrify(string) do |mapping, codepoint| mapping[1] || mapping[0] || "" end else transmogrify(string) do |mapping, codepoint| mapping[0] || mapping[1] || "" end end end