[#boost-urls-encoding_opts-space_as_plus] = xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/encoding_opts.adoc[encoding_opts]::space_as_plus :relfileprefix: ../../../ :mrdocs: True if spaces encode to and from plus signs == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/encoding_opts.hpp#L89[boost/url/encoding_opts.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- 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 xref:boost/urls/encode-0d.adoc[`encode`] and `encode_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 * https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1[] * https://datatracker.ietf.org/doc/html/rfc1866#section-8.2.1[] * https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2.2[] [.small]#Created with https://www.mrdocs.com[MrDocs]#