Skip to content

Commit 7a3c69f

Browse files
mikewestannevk
authored andcommitted
Percent-encode additional characters in "fragment state"
Currently, we percent-encode characters in "fragment state" using the C0 control percent-encode set. Firefox encodes more than that, and it seems reasonable to align around that behavior for reasons spelled out in #291 and the comments of #344. This patch adds a new "fragment percent-encode set" which contains the C0 control percent-encode set, along with: * 0x20 (SP) * 0x22 (") * 0x3C (<) * 0x3E (>) * 0x60 (`) Tests: web-platform-tests/wpt#7776. Closes #344.
1 parent b1e358d commit 7a3c69f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

url.bs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,11 @@ contains bytes that are not <a>ASCII bytes</a> might be insecure and is not reco
179179
<p>The <dfn oldids=simple-encode-set>C0 control percent-encode set</dfn> are the <a>C0 controls</a>
180180
and all <a>code points</a> greater than U+007E (~).
181181

182+
<p>The <dfn>fragment percent-encode set</dfn> is the <a>C0 control percent-encode set</a> and
183+
U+0020 SPACE, U+0022 ("), U+003C (&lt;), U+003E (&gt;), and U+0060 (`).
184+
182185
<p>The <dfn oldids=default-encode-set>path percent-encode set</dfn> is the
183-
<a>C0 control percent-encode set</a> and U+0020 SPACE, U+0022 ("), U+0023 (#), U+003C (&lt;),
184-
U+003E (>), U+003F (?), U+0060 (`), U+007B ({), and U+007D (}).
186+
<a>fragment percent-encode set</a> and U+0023 (#), U+003F (?), U+007B ({), and U+007D (}).
185187

186188
<p>The <dfn oldids=userinfo-encode-set>userinfo percent-encode set</dfn> is the
187189
<a>path percent-encode set</a> and U+002F (/), U+003A (:), U+003B (;), U+003D (=), U+0040 (@),
@@ -2184,7 +2186,7 @@ string <var>input</var>, optionally with a <a>base URL</a> <var>base</var>, opti
21842186
<li><p>If <a>c</a> is U+0025 (%) and <a>remaining</a> does not start with two
21852187
<a>ASCII hex digits</a>, <a>validation error</a>.
21862188

2187-
<li><p><a>UTF-8 percent encode</a> <a>c</a> using the <a>C0 control percent-encode set</a>
2189+
<li><p><a>UTF-8 percent encode</a> <a>c</a> using the <a>fragment percent-encode set</a>
21882190
and append the result to <var>url</var>'s <a for=url>fragment</a>.
21892191
</ol>
21902192
</dl>

0 commit comments

Comments
 (0)