From: Wiley Davis Date: 2009-10-11T23:02:11+09:00 Subject: Re: Can't use variable from cgi with hpricot > A cursory examination of those strings reveals that they are not > identical. > > The rule: certain characters have to be 'transformed' in order to pass > them in a query string attached to the end of a url. That means the > special characters have to be 'untransformed' on the other side. Thanks for pointing out the unescape, something I hadn't thought of. Unfortunately, as I'm using it at least, that didn't fix the problem. It works when I do this: @linky = "http%3A%2F%2Fpracticalpedal.com" @linky = CGI.unescape(@linky) @result = open(@linky) @doc = Hpricot(@result) @title = (@doc/"title").inner_html @result.close puts @title But it gives me a 500 Internal Server Error when I do this: cgi = CGI.new @linky = cgi['link'] @linky = CGI.unescape(@linky) @result = open(@linky) @doc = Hpricot(@result) @title = (@doc/"title").inner_html @result.close puts @title I'm pretty sure the @linky = cgi['link'] is working because when I remove the hpricot part of the code and just display the variable with a puts @linky, I get the correct string as output. -- Posted via http://www.ruby-forum.com/.