url-encoder icon indicating copy to clipboard operation
url-encoder copied to clipboard

Add charset=utf8 to "Ready for CSS"

Open VictoriaMaksimova opened this issue 7 years ago • 1 comments

Hi! Thank you for a nice tool :)

For IE it's important to add 'charset=utf8' for background-image property like this background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3C/svg%3E"); If you don't do this, the image will not be displayed.

It would be nice to add charset automatically, what do you think?

VictoriaMaksimova avatar Dec 19 '17 09:12 VictoriaMaksimova

Which IE versions is this needed for?

According to Taylor Hunt's blog post, Optimizing SVGs in data URIs, which references RFC 2397:

The best way of encoding SVG in a data: URI is data:image/svg+xml,[actual data]. We don’t need the ;charset=utf-8 parameter (or the invalid ;utf8 parameter in the first example), because the given SVG is ASCII.

HatScripts avatar Nov 07 '20 15:11 HatScripts