Should URLEncode convert whitespace to "%20" or "+"?

RFC 3986 specifies that URIs should use percent encoding (%20) for space characters

The Mathematica URLEncode function is documented as “converts into a URL-style, percent-encoded ASCII string”

It seems that “+” is only valid as an encoding for a space in the form data part of a URL. For details see

http://stackoverflow.com/questions/2678551/when-to-encode-space-to-plus-or-20

Therefore, the URLQueryEncode might be expected to convert spaces to plus signs however URLEncode should be converting spaces to “%20.”

If this is an accurate interpretation of the specifications then it seems URLEncode has a bug in how it encodes spaces.

2 Likes