backport URI.encode_www_form for Ruby 1.8 support