Project

General

Profile

Actions

Bug #11819

closed

URI::encode issue with the "+" character

Added by anykeyh (Yacine PETITPREZ) over 8 years ago. Updated over 8 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
[ruby-core:72137]

Description

URI.encode("a+b") returns "a+b". Mostly all web servers transform the "+" in URI parameters to space, and can create issue with base64 encoded parameters for example.

Currently we must write this:

args = URI.encode(args).gsub("+", "%2B")

Also, the rfc2396 says (G. 2):

The plus "+", dollar "$", and comma "," characters have been added to those in the "reserved" set, since they are treated as reserved within the query component.

Updated by naruse (Yui NARUSE) over 8 years ago

  • Status changed from Open to Rejected

As the manual says URI.escape escapes invalid characters in URI; you know "+" is valid.

Use URI. encode_www_form or URI.encode_www_form_component.

Actions

Also available in: Atom PDF

Like0
Like0