Hello,

I'm trying to retrieve search results from the internet using nokogiri and open-uri. Apparently 'open-uri' can't handle directly UTF-8. So I'm trying to convert the string in ASCII but still I come up with an error. Here is the chunk of code:
----------------------------------------
# encoding: UTF-8
 
require "nokogiri"
require "open-uri"

word = "˦˦Ǧͦɦ"
ascii_word = word.force_encoding("ASCII").to_s
result = open("http://search.lycos.com/web?q=#{ascii_word}", "User-Agent" => "HTTP_USER_AGENT:Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.47 S
doc = Nokogiri::HTML(result)
----------------------------------------
And the error I get is: 
----------------------------------------
[...]:in `open': invalid byte sequence in US-ASCII (ArgumentError)
	from lycos.rb:8:in `<main>'
----------------------------------------

I'm on MacOSX ML, using ruby (rvm) 1.9.3 .

I tried using 'force_encofing("US-ASCII")' but it's not a recognized format. The word is Greek and uses UTF-8. Any ideas would be welcomed.

Thanks for your time,

Best Regards

Panagiotis (atmosx) Atmatzidis

email:	atma / convalesco.org
URL:	http://www.convalesco.org
GnuPG ID: 0xE736C6A0
gpg --keyserver x-hkp://pgp.mit.edu --recv-keys 0xE736C6A0
--
The wise man said: "Never argue with an idiot. They bring you down to their level and beat you with experience."