James Gray wrote:
> Try adding the -KU switch to Ruby, to put it in UTF-8 mode.

Thank you for your really fast answer. I tried this:
$ ruby -KU -e "require 'iconv'; puts 
Iconv.conv('US-ASCII//TRANSLIT','UTF-8','éèêë')"
????

$ ruby -e "\$KCODE='u'; require 'iconv'; puts 
Iconv.conv('US-ASCII//TRANSLIT','UTF-8','éèêë')"
????

and for information, I have also also:
$ echo 'éèêë' | iconv -t ASCII//TRANSLIT -f UTF-8
eeee

$ iconv --version
iconv (GNU libc) 2.7

irb(main):002:0> 'é'.each_byte {|x| puts x}
195
169
=> "\303\251"

$ ruby -e "'é'.each_byte {|x| puts x}"
195
169

and finally, the most weird, irb doesn't work if I use pipe:
$ echo "require 'iconv'; puts 
Iconv.conv('US-ASCII//TRANSLIT','UTF-8','é'); 'é'.each_byte{|x| puts x}" 
| irb
require 'iconv'; puts Iconv.conv('US-ASCII//TRANSLIT','UTF-8','é'); 
'é'.each_byte{|x| puts x}
?
195
169
"\303\251"
-- 
Posted via http://www.ruby-forum.com/.