From: James Gray Date: 2008-10-14T02:54:31+09:00 Subject: Re: Iconv and incompatible encodings On Oct 13, 2008, at 12:48 PM, Davi Barbosa wrote: > I have also a problem with iconv. I'm under linux (configured with > utf-8 > as usual) and under irb I get: > irb(main):016:0> Iconv.conv("US-ASCII//TRANSLIT","UTF-8",'éèêë') > => "eeee" > > But when I try the same in ruby or mod_ruby I get '????', for example: > $ ruby -e "require 'iconv'; puts > Iconv.conv('US-ASCII//TRANSLIT','UTF-8','éèêë')" > ???? > I already checked with str.each_byte {|x| puts x} and the strings are > exactly the same. Does anyone have any idea why I get two different > answers from Iconv? > > My system: > $ irb --version > irb 0.9.5(05/04/13) > $ ruby --version > ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux] > > I have ENV['LANG']==en_US.UTF-8 in both cases. Try adding the -KU switch to Ruby, to put it in UTF-8 mode. James Edward Gray II