Skip to content

Conversation

@ChALkeR
Copy link
Collaborator

@ChALkeR ChALkeR commented Jan 23, 2026

cc @domenic

Ref: https://url.spec.whatwg.org/#string-percent-encode-after-encoding

Draft

Single-byte path is untested yet, needs tests to land

I might rename the export to something else

Api

  1. C0 control percent-encode set is always percent-encoded (below U+0020, U+007F, above U+007F).

  2. Other chars to encode are specified as a literal string percentEncodeSet, containing unique increasing codepoints in range 0x20 - 0x7e. No sets except C0 are hardcoded.

  3. I made this non-fatal, unlike encodeURIComponent it now normalizes the input to a well-formed string. I can revert that and throw on non-scalarvalue strings instead.

    The only thing that's not acceptable there is trusting the input to be scalarvalue and returning e.g. � on \d800

    In the actual usage all input to the spec-defined method is expected to be scalarvalue.

@ChALkeR ChALkeR force-pushed the chalker/percentEncodeAfterEncoding/0 branch from 6ab73f8 to 9b8fd67 Compare January 23, 2026 20:35
@ChALkeR ChALkeR force-pushed the chalker/percentEncodeAfterEncoding/0 branch 7 times, most recently from 56052c5 to eacc182 Compare January 23, 2026 21:57
@ChALkeR
Copy link
Collaborator Author

ChALkeR commented Jan 24, 2026

@domenic I think the spec is wrong
Upd: whatwg/url#895
Upd: fix in whatwg/url#896

@ChALkeR ChALkeR force-pushed the chalker/percentEncodeAfterEncoding/0 branch 15 times, most recently from 11c6dfc to 3628d3a Compare January 24, 2026 12:44
@ChALkeR ChALkeR requested a review from Copilot January 24, 2026 19:46

This comment was marked as outdated.

@ChALkeR ChALkeR force-pushed the chalker/percentEncodeAfterEncoding/0 branch from 3628d3a to f8e5f94 Compare January 24, 2026 19:58
@ChALkeR ChALkeR requested a review from Copilot January 24, 2026 19:59
@ChALkeR ChALkeR marked this pull request as ready for review January 24, 2026 20:00

This comment was marked as resolved.

@ChALkeR ChALkeR force-pushed the chalker/percentEncodeAfterEncoding/0 branch from f8e5f94 to 5c508cb Compare January 24, 2026 20:22
@ChALkeR ChALkeR force-pushed the chalker/percentEncodeAfterEncoding/0 branch from 5c508cb to a205a2e Compare January 24, 2026 20:34
@ChALkeR ChALkeR requested a review from Copilot January 24, 2026 20:38

This comment was marked as outdated.

This comment was marked as outdated.

This comment was marked as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants