It uses encoding of a page URL is extracted from, not of a page URL leads to.
And how would you deal with an URL to the HTML itself?
There 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.
Re:My url isn't your url
by jrochkind1 on Wednesday May 11, 2016 @02:03PM
(#11677672)
This 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?
Yeah, 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.
Maybe I'm misunderstanding, but how could a browser use page-encoding before the page has been fetched?