Daniel DeLorme <dan-ml / dan42.com> wrote:

> 
> That doesn't work on all platforms. For me:
> 
>  >> require "iconv"
> => true
>  >> i = Iconv.new("ASCII//TRANSLIT", "UTF-8")
> => #<Iconv:0xb7cf28e0>
>  >> i.iconv("au")
> => "a?ou? AE"
> 
> :-(

Are u sure about the encoding of "au" ?

because i did it with UTF-8, it works :

-- the script ----------------------------------------------------------
#! /usr/bin/env ruby

require "iconv"

i = Iconv.new("ASCII//TRANSLIT", "UTF-8")

p i.iconv("au")
# => "a'eou\"i AE"

p i.iconv("au").gsub(/[^a-zA-Z0-9 ]/, '')
# => "aeoui AE"

p i.iconv("re ou ne pas re, c'est la question. au, wie hei du
?").gsub(/[^a-zA-Z0-9' ]/, '').gsub(/[' ]/, '_').gsub(/(.*)_$/, '\1')
# => "Etre_ou_ne_pas_etre_c_est_la_question_a_eoui_AE_wie_heiss_du"

p i.iconv("re ou ne pas re, c'est la question. au, wie hei
du?").gsub(/[^a-zA-Z0-9' ]/, '').gsub(/[' ]/, '_').gsub(/(.*)_$/, '\1')
# => "Etre_ou_ne_pas_etre_c_est_la_question_a_eoui_AE_wie_heiss_du"
------------------------------------------------------------------------
-- 
Une Bue