Skip to content

Workaround for multi byte chars in Location header

nahi edited this page Apr 19, 2011 · 3 revisions

For 2.2.0. (Should work earlier versions, too)

require 'httpclient'
c = HTTPClient.new
c.redirect_uri_callback = proc { |uri, res| URI.escape(res.headers["Location"]) }
p c.get("http://bit.ly/eDWCrk", :follow_redirect => true)
Clone this wiki locally