url decode problem solution

  • 2020-05-10 17:52:18
  • OfStack

The urllib library of python and encodeURIComponent of js will not be replaced. The space encode is also replaced by '%20'. python provides urllib.quote_plus, urlib.unquote_plus to handle Spaces - > Plus, that seems reasonable.

Check 1: RFC 3986: has the following paragraph

Scheme names consist of a sequence of characters beginning with a letter and followed by any combination of letters, digits, plus ("+"), period ("."), or hyphen ("-").
RFC 2396 has the following paragraph

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.
Indicates that the plus sign is already reserved for url and does not need to be escaped.

The html4 document then contains the escape for the plus sign:

application/x-www-form-urlencoded
Forms submitted with this content type must be encoded as follows:
Control names and values are escaped. Space characters are replaced by`+', and then reserved characters.....
Declare that + is escaped only if content-type is application/ x-www-form-urlencoded.

I checked the php files again and found one

rawurlencode() - URL-encode according to RFC 3986


So php and rawurlencode and rawurldecode to implement the standard...

Can't you invert 1? After all, most people should be able to use urlencode. php is a pain in the neck...

Related articles: