True if spaces encode to and from plus signs

Synopsis

bool space_as_plus = false;

Description

Although not prescribed by RFC 3986, many applications decode plus signs in URL queries as spaces. In particular, the form‐urlencoded Media Type in HTML for submitting forms uses this convention.

This option controls whether the PLUS character ("+") is used to represent the SP character (" ") when encoding or decoding.

When this option is true, both the encoded SP ("%20") and the PLUS character ("+") represent a space (" ") when decoding. To represent a plus sign, its encoded form ("%2B") is used.

The encode and encoded_size functions will encode spaces as plus signs when this option is true, regardless of the allowed character set. They will also encode plus signs as "%2B" when this option is true, regardless of the allowed character set.

Note that when a URL is normalized, all unreserved percent‐encoded characters are replaced with their unreserved equivalents. However, normalizing the URL query maintains the decoded and encoded "&=+" as they are because they might have different meanings.

This behavior is not optional because normalization can only mitigate false negatives, but it should eliminate false positives. Making it optional would allow a false positive because there's at least one very relevant schema (HTTP) where a decoded or encoded "&=+" has different meanings and represents different resources.

The same considerations apply to URL comparison algorithms in the library, as they treat URLs as if they were normalized.

Specification