Martin DeMello wrote: > Dave Burt <dave / burt.id.au> wrote: >> >> tranmap.inject(self) do |str, (utf8, asc)| >> p [utf8, asc] >> str.gsub(utf8, asc) >> end >> end >> end >> >> "IõÓnãÕißÍizëÕiøî".utf8_trans_unaccent #=> "Internationalizaetion" > > # one time preprocessing > INTL, ASC = "", "" > tranmap.each {|k,v| > INTL << k > ASC << v > } > > # quicker than repeated gsubs: > str.tr(INTL, ASC) Except that won't work, because tr only matches bytes, not multi-byte characters. (It might work after applying one of the Unicode string extensions that have been floating around recently. But not in standard Ruby.) Cheers, Dave