Subject: Open-uri with non-ascii character
	Date: Sun 06 Jan 13 12:03:01PM +0900

Quoting Soichi Ishida (lists / ruby-forum.com):

> I want to parse a page like
> 
> http://www.unicode.org/cgi-bin/GetUnihanData.pl?codepoint=???
> the url contains non-ascii character as a query.  In this particular
> case, it's Chinese.
> 
> If I try to open this page like
> 
> doc = Nokogiri::HTML(open(query)).read

Try this (query must contain the correct UTF-8):

require 'webrick/httputils'

..
..

query.force_encoding('binary')
query=WEBrick::HTTPUtils.escape(query)
doc=Nokogiri::HTML(open(query)).read

Carlo

-- 
  *         Se la Strada e la sua Virtu' non fossero state messe da parte,
* K * Carlo E. Prelz - fluido / fluido.as             che bisogno ci sarebbe
  *               di parlare tanto di amore e di rettitudine? (Chuang-Tzu)