Bug 226136 - URL path setter messes up UTF-8 encoding after ?
Summary: URL path setter messes up UTF-8 encoding after ?
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alex Christensen
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-05-21 22:10 PDT by Timothy Gu
Modified: 2021-05-26 10:35 PDT (History)
6 users (show)

See Also:


Attachments
Patch (5.56 KB, patch)
2021-05-24 09:30 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Timothy Gu 2021-05-21 22:10:08 PDT
With the following code:

      u = new URL('http://abc/');
      u.pathname = "/?é";
      console.log(u.pathname);

The string "/%3F%C3%83%C2%A9" is printed. But this is wrong, since é in UTF-8 is 0xC3 0xA9.

If we remove the ?, everything works fine:

      u = new URL('http://abc/');
      u.pathname = "/é";
      console.log(u.pathname); // prints "/%C3%A9"
Comment 1 Alex Christensen 2021-05-24 09:30:05 PDT
Created attachment 429539 [details]
Patch
Comment 2 Alex Christensen 2021-05-24 09:30:29 PDT
Thanks for pointing this out, Timothy!
Comment 3 Chris Dumez 2021-05-26 10:07:32 PDT
Comment on attachment 429539 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=429539&action=review

r=me

> Source/WTF/ChangeLog:10
> +        This matches Chrome, Firefox, and reason.

:)
Comment 4 EWS 2021-05-26 10:34:10 PDT
Committed r278091 (238166@main): <https://commits.webkit.org/238166@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 429539 [details].
Comment 5 Radar WebKit Bug Importer 2021-05-26 10:35:18 PDT
<rdar://problem/78520238>