pere.noel / laponie.com.invalid (Une b?vue) writes:

> Dave Burt <dave / burt.id.au> wrote:
>
>> My version might look like this:
>> 
>> NON_ASCII = /[\x80-\xff]/
>> "I?t?rn?ti?n?liz?ti?n".gsub(NON_ASCII, "?") #=> "I?t?rn?ti?n?liz?ti?n"
>
> i'd like not to remove no-ascii chars but replace all accentuated chars
> (in an UTF-8 string) by them non-accentuated counterpart :
>
> ? => e
> ? => a
> ? => c
>
> [...]
>
> what is the best way to do that in Ruby?

How about this:

require 'iconv'
puts Iconv.open("ASCII//TRANSLIT", "ISO-8859-1").iconv("I?t?rn?ti?n?liz?ti?n")

#=> I~nt"ern^ati^on`alizaetion

> une b?vue
-- 
Christian Neukirchen  <chneukirchen / gmail.com>  http://chneukirchen.org