




























@@ -448,30 +448,37 @@ the input, and percent-decoding results in a byte sequence with less 0x25 (%) by
448448449449<hr>
450450451-<p>The <dfn oldids=simple-encode-set>C0 control percent-encode set</dfn> are the <a>C0 controls</a>
452-and all <a>code points</a> greater than U+007E (~).
451+<p>A <dfn>percent-encode set</dfn> is a <a for=/>set</a> of <a for=/>code points</a>.
453452454-<p>The <dfn>fragment percent-encode set</dfn> is the <a>C0 control percent-encode set</a> and
455-U+0020 SPACE, U+0022 ("), U+003C (<), U+003E (>), and U+0060 (`).
453+<p>The <dfn oldids=simple-encode-set>C0 control percent-encode set</dfn> is a
454+<a>percent-encode set</a> consisting of <a>C0 controls</a> and all <a>code points</a> greater than
455+U+007E (~).
456456457-<p>The <dfn>query percent-encode set</dfn> is the <a>C0 control percent-encode set</a> and
458-U+0020 SPACE, U+0022 ("), U+0023 (#), U+003C (<), and U+003E (>).
457+<p>The <dfn>fragment percent-encode set</dfn> is a <a>percent-encode set</a> consisting of the
458+<a>C0 control percent-encode set</a> and U+0020 SPACE, U+0022 ("), U+003C (<), U+003E (>), and
459+U+0060 (`).
460+461+<p>The <dfn>query percent-encode set</dfn> is a <a>percent-encode set</a> consisting of the
462+<a>C0 control percent-encode set</a> and U+0020 SPACE, U+0022 ("), U+0023 (#), U+003C (<), and
463+U+003E (>).
459464460465<p class=note>The <a>query percent-encode set</a> cannot be defined in terms of the
461466<a>fragment percent-encode set</a> due to the omission of U+0060 (`).
462467463-<p>The <dfn>special-query percent-encode set</dfn> is the <a>query percent-encode set</a> and
464-U+0027 (').
468+<p>The <dfn>special-query percent-encode set</dfn> is a <a>percent-encode set</a> consisting of
469+the <a>query percent-encode set</a> and U+0027 (').
465470466-<p>The <dfn oldids=default-encode-set>path percent-encode set</dfn> is the
467-<a>query percent-encode set</a> and U+003F (?), U+005E (^), U+0060 (`), U+007B ({), and U+007D (}).
471+<p>The <dfn oldids=default-encode-set>path percent-encode set</dfn> is a <a>percent-encode set</a>
472+consisting of the <a>query percent-encode set</a> and U+003F (?), U+005E (^), U+0060 (`),
473+U+007B ({), and U+007D (}).
468474469-<p>The <dfn oldids=userinfo-encode-set>userinfo percent-encode set</dfn> is the
470-<a>path percent-encode set</a> and U+002F (/), U+003A (:), U+003B (;), U+003D (=), U+0040 (@),
471-U+005B ([) to U+005D (]), inclusive, and U+007C (|).
475+<p>The <dfn oldids=userinfo-encode-set>userinfo percent-encode set</dfn> is a
476+<a>percent-encode set</a> consisting of the <a>path percent-encode set</a> and U+002F (/),
477+U+003A (:), U+003B (;), U+003D (=), U+0040 (@), U+005B ([) to U+005D (]), inclusive, and U+007C (|).
472478473-<p>The <dfn export>component percent-encode set</dfn> is the <a>userinfo percent-encode set</a> and
474-U+0024 ($) to U+0026 (&), inclusive, U+002B (+), and U+002C (,).
479+<p>The <dfn export>component percent-encode set</dfn> is a <a>percent-encode set</a> consisting of
480+the <a>userinfo percent-encode set</a> and U+0024 ($) to U+0026 (&), inclusive, U+002B (+), and
481+U+002C (,).
475482476483<p class=note>This is used by <cite>HTML</cite> for
477484{{NavigatorContentUtils/registerProtocolHandler()}}, and could also be used by other standards to
@@ -480,20 +487,27 @@ percent-encode data that can then be embedded in a <a for=/>URL</a>'s <a for=url
480487<a for=string>UTF-8 percent-encode</a> gives identical results to JavaScript's
481488<a method><code>encodeURIComponent()</code> [sic]</a>. [[HTML]] [[ECMA-262]]
482489483-<p>The <dfn><code>application/x-www-form-urlencoded</code> percent-encode set</dfn> is the
484-<a>component percent-encode set</a> and U+0021 (!), U+0027 (') to U+0029 RIGHT PARENTHESIS,
485-inclusive, and U+007E (~).
490+<p>The <dfn><code>application/x-www-form-urlencoded</code> percent-encode set</dfn> is a
491+<a>percent-encode set</a> consisting of the <a>component percent-encode set</a> and U+0021 (!),
492+U+0027 (') to U+0029 RIGHT PARENTHESIS, inclusive, and U+007E (~).
486493487494<p class=note>The <a><code>application/x-www-form-urlencoded</code> percent-encode set</a> contains
488495all code points, except the <a>ASCII alphanumeric</a>, U+002A (*), U+002D (-), U+002E (.), and
489496U+005F (_).
490497491498<div algorithm>
492499<p>To <dfn for=string>percent-encode after encoding</dfn>, given an <a for=/>encoding</a>
493-<var>encoding</var>, <a for=/>scalar value string</a> <var>input</var>, a
494-<var>percentEncodeSet</var>, and an optional boolean <var>spaceAsPlus</var> (default false):
500+<var>encoding</var>, <a for=/>scalar value string</a> <var>input</var>, and a
501+<a>percent-encode set</a> <var>percentEncodeSet</var>:
495502496503<ol>
504+<li><p><a for=/>Assert</a>: <var>encoding</var> is <a for=/>UTF-8</a> or
505+<var>percentEncodeSet</var> is <a>special-query percent-encode set</a> or
506+<a><code>application/x-www-form-urlencoded</code> percent-encode set</a>.
507+508+<li><p>Let <var>spaceAsPlus</var> be true if <var>percentEncodeSet</var> is
509+<a><code>application/x-www-form-urlencoded</code> percent-encode set</a>; otherwise false.
510+497511<li><p>Let <var>encoder</var> be the result of <a>getting an encoder</a> from <var>encoding</var>.
498512499513<li><p>Let <var>inputQueue</var> be <var>input</var> converted to an <a for=/>I/O queue</a>.
@@ -594,7 +608,7 @@ result of running <a for=string>percent-encode after encoding</a> with <a for=/>
594608<td>0xE2 0x80 0xBD 0x25 0x2E
595609<tr>
596610<td rowspan=3><a for=string>Percent-encode after encoding</a> with <a>Shift_JIS</a>,
597-<var>input</var>, and the <a>userinfo percent-encode set</a>
611+<var>input</var>, and the <a>special-query percent-encode set</a>
598612<td>"<code> </code>"
599613<td>"<code>%20</code>"
600614<tr>
@@ -605,14 +619,14 @@ result of running <a for=string>percent-encode after encoding</a> with <a for=/>
605619<td>"<code>%26%238253%3B</code>"
606620<tr>
607621<td><a for=string>Percent-encode after encoding</a> with <a>ISO-2022-JP</a>, <var>input</var>,
608- and the <a>userinfo percent-encode set</a>
622+ and the <a>special-query percent-encode set</a>
609623<td>"<code>¥</code>"
610624<td>"<code>%1B(J\%1B(B</code>"
611625<tr>
612-<td><a for=string>Percent-encode after encoding</a> with <a>Shift_JIS</a>, <var>input</var>, the
613-<a>userinfo percent-encode set</a>, and true
626+<td><a for=string>Percent-encode after encoding</a> with <a>Shift_JIS</a>, <var>input</var>, and
627+the <a><code>application/x-www-form-urlencoded</code> percent-encode set</a>
614628<td>"<code>1+1 ≡ 2%20‽</code>"
615-<td>"<code>1+1+%81%DF+2%20%26%238253%3B</code>"
629+<td>"<code>1%2B1+%81%DF+2%2520%26%238253%3B</code>"
616630<tr>
617631<td rowspan=2><a for="code point">UTF-8 percent-encode</a> <var>input</var> using the
618632<a>userinfo percent-encode set</a>
@@ -3380,13 +3394,12 @@ takes a list of name-value tuples <var>tuples</var>, with an optional <a for=/>e
33803394<a for=/>scalar value strings</a>.
3381339533823396<li><p>Let <var>name</var> be the result of running
3383-<a for=string>percent-encode after encoding</a> with <var>encoding</var>,
3384-<var>tuple</var>'s name, the
3385-<a><code>application/x-www-form-urlencoded</code> percent-encode set</a>, and true.
3397+<a for=string>percent-encode after encoding</a> with <var>encoding</var>, <var>tuple</var>'s
3398+ name, and the <a><code>application/x-www-form-urlencoded</code> percent-encode set</a>.
3386339933873400<li><p>Let <var>value</var> be the result of running
33883401<a for=string>percent-encode after encoding</a> with <var>encoding</var>, <var>tuple</var>'s
3389- value, the <a><code>application/x-www-form-urlencoded</code> percent-encode set</a>, and true.
3402+ value, and the <a><code>application/x-www-form-urlencoded</code> percent-encode set</a>.
3390340333913404<li><p>If <var>output</var> is not the empty string, then append U+0026 (&) to
33923405<var>output</var>.
@@ -4184,6 +4197,7 @@ Michael™ Smith,
41844197Michal Bukovský,
41854198Michel Suignard,
41864199Mikaël Geljić,
4200+Nikita Skovoroda,<!-- ChALkeR; GitHub -->
41874201Noah Levitt,
41884202Peter Occil,
41894203Philip Jägenstedt,
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。