diff --git a/url.bs b/url.bs index b66bb1e1..d26a2f6c 100644 --- a/url.bs +++ b/url.bs @@ -217,67 +217,56 @@ inclusive, and U+007E (~). all code points, except the ASCII alphanumeric, U+002A (*), U+002D (-), U+002E (.), and U+005F (_). -
To percent-encode after encoding, given an encoding -encoding, code point codePoint, and a -percentEncodeSet, run these steps: +
To percent-encode after encoding, given an encoding +encoding, string input, a percentEncodeSet, and an +optional boolean spaceAsPlus (default false), run these steps:
Let bytes be the result of encoding codePoint using - encoding. +
Let encoder be the result of getting an encoder from encoding. -
If bytes starts with 0x26 (&) 0x23 (#) and ends with 0x3B (;), then: - -
Let output be bytes, isomorphic decoded. +
Let inputQueue be input converted to an I/O queue. -
Replace the first two code points of output with "%26%23
".
-
-
Replace the last code point of output with "%3B
".
-
-
Return output. -
Let output be the empty string. -
This can happen when encoding is not UTF-8. +
Let potentialError be 0. -
Let output be the empty string.
This needs to be a non-null value to initiate the subsequent while loop.
For each byte of bytes: +
While potentialError is non-null:
Let isomorph be a code point whose value - is byte's value. +
Let encodeOutput be an empty I/O queue. -
Assert: percentEncodeSet includes all non-ASCII code points. +
Set potentialError to the result of running encode or fail with + inputQueue, encoder, and encodeOutput. -
If isomorph is not in percentEncodeSet, then append - isomorph to output. +
For each byte of encodeOutput converted to a byte sequence: -
Otherwise, percent-encode byte and append the result to - output. -
If spaceAsPlus is true and byte is 0x20 (SP), then append + U+002B (+) to output. -
Return output. -
Let isomorph be a code point whose value + is byte's value. -
To percent-encode after encoding, given an encoding -encoding, string input, a percentEncodeSet, and a -boolean spaceAsPlus, run these steps: +
Assert: percentEncodeSet includes all non-ASCII code points. -
Let output be the empty string.
If isomorph is not in percentEncodeSet, then append + isomorph to output. -
For each codePoint of input: +
Otherwise, percent-encode byte and append the result to + output. +
If spaceAsPlus is true and codePoint is U+0020, then append - U+002B (+) to output. +
If potentialError is non-null, then append "%26%23
", followed by the
+ shortest sequence of ASCII digits representing potentialError in base
+ ten, followed by "%3B
", to output.
-
Otherwise, run percent-encode after encoding with - encoding, codePoint, and percentEncodeSet, and append the result - to output. +
This can happen when encoding is not UTF-8.
Return output. @@ -285,13 +274,13 @@ boolean spaceAsPlus, run these steps:
To UTF-8 percent-encode a code point codePoint using a percentEncodeSet, return the result -of running percent-encode after encoding with UTF-8, -codePoint, and percentEncodeSet. +of running percent-encode after encoding with UTF-8, +codePoint as a string, and percentEncodeSet.
To UTF-8 percent-encode a string input using a percentEncodeSet, return the result of running -percent-encode after encoding with UTF-8, input, -percentEncodeSet, and false. +percent-encode after encoding with UTF-8, input, and +percentEncodeSet.
‽%25%2E
"
"
%20
"
≡
"
%81%DF
"
‽
"
%26%238253%3B
"
¥
"
%1B(J\%1B(B
"