From: Eduardo San Martin Morote Date: Tue, 6 Oct 2020 12:26:17 +0000 (+0200) Subject: docs(encoding): add comment about plus character X-Git-Tag: v4.0.0-rc.1~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b0c89d687223f19bcf7f6da27f2eff66ec7268ea;p=thirdparty%2Fvuejs%2Frouter.git docs(encoding): add comment about plus character --- diff --git a/src/encoding.ts b/src/encoding.ts index 2c2df76a..8d1a6602 100644 --- a/src/encoding.ts +++ b/src/encoding.ts @@ -23,6 +23,21 @@ const AMPERSAND_RE = /&/g // %26 const SLASH_RE = /\//g // %2F const EQUAL_RE = /=/g // %3D const IM_RE = /\?/g // %3F +/** + * NOTE: It's not clear to me if we should encode the + symbol in queries, it + * seems to be less flexible than not doing so and I can't find out the legacy + * systems requiring this for regular requests like text/html. In the standard, + * the encoding of the plus character is only mentioned for + * application/x-www-form-urlencoded + * (https://url.spec.whatwg.org/#urlencoded-parsing) and most browsers seems lo + * leave the plus character as is in queries. To be more flexible, we allow the + * plus character on the query but it can also be manually encoded by the user. + * + * Resources: + * - https://url.spec.whatwg.org/#urlencoded-parsing + * - https://stackoverflow.com/questions/1634271/url-encoding-the-space-character-or-20 + */ +// const PLUS_RE = /\+/g // %3F const ENC_BRACKET_OPEN_RE = /%5B/g // [ const ENC_BRACKET_CLOSE_RE = /%5D/g // ]