- From: Matt Giuca <notifications@github.com>
- Date: Thu, 14 May 2020 21:43:09 -0700
- To: whatwg/url <url@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/url/pull/518/review/412341558@github.com>
@mgiuca commented on this pull request. Just leaving some comments to address @rmisev 's feedback. I haven't gone over the rest in fine detail, but a quick read says this looks fantastic! This makes the parser a lot cleaner (at the expense of the percent-encode logic, but I'd rather move complexity out of the parser and into the percent encoder). > -<p>To <dfn for="code point" id=utf-8-percent-encode>UTF-8 percent-encode</dfn> a -<a for=/>code point</a> <var>codePoint</var> using a <var>percentEncodeSet</var>, run these steps: +<p class=note>The <a>application/x-www-form-urlencoded percent-encode set</a> contains all code +points, except the <a>ASCII alphanumeric</a>, U+002A (*), U+002D (-), U+002E (.), and U+005F (_). + +<p>To <dfn for="code point">percent-encode after encoding</dfn>, given an <a for=/>encoding</a> +<var>encoding</var>, <a for=/>code point</a> <var>codePoint</var>, and a +<var>percentEncodeSet</var>, run these steps: <ol> <li><p>If <var>codePoint</var> is not in <var>percentEncodeSet</var>, then return Delete this. > + <var>encoding</var>. + + <li> + <p>If <var>bytes</var> starts with 0x26 (&) 0x23 (#) and ends with 0x3B (;), then: + + <ol> + <li><p>Let <var>output</var> be <var>bytes</var>, <a>isomorphic decoded</a>. + + <li><p>Replace the first two code points of <var>output</var> with "<code>%26%23</code>". + + <li><p>Replace the last code point of <var>output</var> with "<code>%3B</code>". + + <li><p>Return <var>output</var>. + </ol> + + <p class="note no-backref">This can happen when <var>encoding</var> is not <a>UTF-8</a>. <li><p>Let <var>output</var> be the empty string.</p></li> Replace this with: ```html <li><p>For each <var>byte</var> of <var>bytes, if <var>byte</var> is not an <a>ASCII byte</a>, or if the code point whose value is <var>byte</var> is not in <var>percentEncodeSet</var>, <a for=byte>percent-encode</a> <var>byte</var> and append the result to <var>output</var>. Otherwise, append the code point whose value is <var>byte</var> to <var>output</var>. ``` (Possibly splitting into some nested list items.) -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/whatwg/url/pull/518#pullrequestreview-412341558
Received on Friday, 15 May 2020 04:43:21 UTC