3 ms·
> For URLs entered to address bar it seems that UTF-8 is used, not page encoding. Maybe I'm misunderstanding, but how could a browser use page-encoding before
by oneeyedpigeon 11y ago
> For URLs entered to address bar it seems that UTF-8 is used, not page encoding.
Maybe I'm misunderstanding, but how could a browser use page-encoding before the page has been fetched?
- kmike84 11y agoIt uses encoding of a page URL is extracted from, not of a page URL leads to.
- wolfgke 11y agoThat's how: https://html.spec.whatwg.org/multipage/syntax.html#determining-the-character-encoding https://html.spec.whatwg.org/multipage/syntax.html#determini...
- ingenter 11y agoAnd how would you deal with an URL to the HTML itself?
- kmike84 11y agoThere are 3 ways to get an URL: a) URL is entered to the address bar. Default encoding (it seems UTF-8) is used for query and fragment. b) User clicks on a link. Page URL is used; page encoding is already known. c) Redirect to a new URL happens. I can't say out of my head what happens in this case.
- jrochkind1 11y agoThis is just a recipe for massive confusion though. You're saying if I click on a link with an IRI in a non-UTF8 html page, it means one thing. But if I copy and paste that link into a text file, and later paste it into a browser, it'll mean something else entirely? Or if I save it to a bookmark using some service?
- kmike84 11y agoYeah, it is a recipe for confusion. Browsers use a workaround: when you copy an URL of a link (using "Copy Link Address" in Chrome or "Copy Link Location" in Firefox) it copies escaped URL, not original URL.