Re: [whatwg/url] Change query state slightly to better deal with non-UTF-8 encodings (#386)

rmisev commented on this pull request.

I think algorithm is correct (I didn't test it). Although all characters which must be encoded (`&#` and `;`) are at known positions, so there no need to scan bytes. I would change the 4 and 5 sub-steps as follows:

4. If <var>bytes</var> starts with \``&#`\` and ends with 0x3B (;), then:
    1. Replace the beginning \``&#`\` in <var>bytes</var> with \``%26%23`\`.
    2. Replace the ending 0x3B (;) in <var>bytes</var> with \``%3B`\`.
    3. Append [isomorphic decoded](https://infra.spec.whatwg.org/#isomorphic-decode) <var>bytes</var> to <var>url</var>’s query.
5. <ins>Otherwise,</ins> for each <var>byte</var> in <var>bytes</var>:
...



-- 
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/386#pullrequestreview-122067058

Received on Tuesday, 22 May 2018 08:34:46 UTC