Re: [csswg-drafts] URL encoding of CSS values (#9301)

The CSS Working Group just discussed `URL encoding of CSS values`, and agreed to the following:

* `RESOLVED: for all urls we encode them as utf-8 when they go down the network stack`

<details><summary>The full IRC log of that discussion</summary>
&lt;emilio> TabAtkins: basic question is what encodings are used by things in the platform to parse URLs<br>
&lt;emilio> ... there's very little interop<br>
&lt;emilio> ... but with the tests that show up right now it seems everybody uses utf-8 for @import<br>
&lt;emilio> ... but in a stylesheet it uses whatever the stylesheet encoding is<br>
&lt;emilio> ... annevk wants to make it explicit<br>
&lt;emilio> ... is everyone fine with that?<br>
&lt;miriam> q?<br>
&lt;miriam> ack TabAtkins<br>
&lt;emilio> ... zcorpan mentions that firefox using utf-8 for all URLs<br>
&lt;emilio> ... and seems to be fine with that<br>
&lt;emilio> ... nobody is concerned about compat fallout<br>
&lt;chris> I would prefer to use UTF-8 always<br>
&lt;chris> q+<br>
&lt;emilio> ... nobody really uses non-ascii-compatible stuff<br>
&lt;emilio> ... so really just a question of standardizing it<br>
&lt;miriam> ack chris<br>
&lt;emilio> ... two choices: all urls are utf-8, or @import utf-8 and sheet encoding for the rest<br>
&lt;fremy> q+<br>
&lt;emilio> chris: I'd prefer utf-8 everywhere<br>
&lt;emilio> emilio: +1 to that, seems better to be consistent<br>
&lt;miriam> ack fremy<br>
&lt;emilio> fremy: is that likely to create invalid files?<br>
&lt;myles> q+ to ask a silly question<br>
&lt;bramus> +1 to chris’s remark<br>
&lt;emilio> emilio: wdym as invalid?<br>
&lt;emilio> fremy: you may end up with content that is not parsable in the encoding<br>
&lt;emilio> TabAtkins: fix is using utf-8<br>
&lt;emilio> fremy: why do we bother to allow utf-8 if the file is in a different encoding<br>
&lt;emilio> TabAtkins: it's not when you parse the file, it's about how you feed it to the url parser<br>
&lt;miriam> ack myles<br>
&lt;Zakim> myles, you wanted to ask a silly question<br>
&lt;emilio> myles: is the proposal that a stylesheet is in an encoding, you find a url and switch encoding?<br>
&lt;emilio> TabAtkins: no, you parse as normal but you feed the url parser telling it that it's utf-8<br>
&lt;andreubotella> IIUC this is for url-encoded bytes (%20 and so on)<br>
&lt;miriam> ack dbaron<br>
&lt;emilio> dbaron: there is a very old backwards compat behavior which is that URLs carry around the encoding of the document that contained them<br>
&lt;emilio> ... so that when the network fetch happens you send the bytes to the server instead of a decoded version of them<br>
&lt;emilio> ... ideally that should only happen when this backwards compat hack is required<br>
&lt;emilio> ... and has been phased out generally to use utf-8 rather than that<br>
&lt;emilio> myles: so you get a file, decode decode decode, some stylesheet has a URL and you need to go back and send those bytes rather than the decoded stuff?<br>
&lt;emilio> dbaron: the new old way of doing it, not the old old way, is that you store the encoding of the thing in which you found the url along the url<br>
&lt;emilio> ... purpose of that is that the server gets the same bytes as the document<br>
&lt;emilio> ... which is a horrible hack to mimic the old old behavior<br>
&lt;emilio> ... which was where the web just carried bytes around<br>
&lt;emilio> myles: So the new old behavior is you round-trip (go bytes to encoding, and then when the request go back to bytes)<br>
&lt;emilio> dbaron: yeah, and there's a migration away from that where we just send utf-8 to the server<br>
&lt;emilio> ... not sure what the status of that migration is<br>
&lt;emilio> ... clearly there's a difference between @import and other urls here<br>
&lt;emilio> myles: so proposal at hand is you decode, see a url, then decode those bytes as utf-8?<br>
&lt;emilio> TabAtkins: dbaron explained it better, when we put the url in the network stack we just stop carrying that encoding and always put it as utf-8<br>
&lt;emilio> myles: perfect<br>
&lt;emilio> dbaron: hope my memory about this is right<br>
&lt;emilio> TabAtkins: proposal is for all urls we encode them as utf-8 when they go down the network stack in accordance with the url standard's recomendation<br>
&lt;emilio> RESOLVED: for all urls we encode them as utf-8 when they go down the network stack<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9301#issuecomment-1718985866 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 14 September 2023 08:21:42 UTC