SVG Export Missing XML Encoding Tag
The latest updates to Illustrator (21.0.1) seems to have removed the all-important encoding tag required by browsers to render SVG appropriately when embedding etc. in an html page.
It exports the svg without this tag at the beginning of the file.
<?xml version="1.0" encoding="UTF-8" ?>
Any news about this? I can't believe this annoying problem is not fixed yet...
We have experienced the exact same problem, but our web developers came up with a simple solution.
In Illustrator: Use the "Export As" option. See screen cap for options selection.
Once exported, open the SVG file in a text editor (WordPad, TextEdit, etc.) and enter the following text at the very beginning.
<?xml version="1.0" encoding="utf-8"?>
That should do the trick. Good luck
Dirk, even if the majority of the viewers doesn't need the tag I can't see why you need to force others to follow? Just add the option, what's the problem? Theres no harm in it, is it? It would spare millions of web designers the extra trip around a text editor for every svg exported for Wordpress.
I am having this same issue. If I "export" as SVG it is missing the needed xml code for wordpress and if I "Save as" the file is too large and I get an error in wordpress trying to load it. I'm at a loss and this is effecting my business as I sell custom SVGs on my WP website.
Thanks a lot for the information. We put the matter under review and will add it to our backlog afterwards.
Just to add, my company is running an implementation of Adobe Experience Manager that will load svgs as black boxes unless the xml tag is present. That's the whole reason I sought out this issue in the first place.
Hi from Adobe,
At this point, the only way to get the <?xml version="1.0" encoding="utf-8"?> element from Illustrator is to use the File > Save as option. We are considering an option to export with the encoding tag in the future.
Appears WordPress is running a validation on the SVGs XML, requiring the <?xml version="1.0" encoding="utf-8"?> be present. Anything we can do to add that back in? Any plugins for illustrator that correct the issue?
I am not sure I understand your issue. Export As does leave <?xml version="1.0" encoding="UTF-8" ?> out on purpose. Especially web browser don't need this tag anymore and some browsers like IE 9 don't even support the SVGs with encoding tag. The majority of SVG viewers beside web browsers don't require this tag either.
Could you provide an example file that would not work w/o the encoding tag?
Thanks a lot,
Hitesh Sharma commented
we are investigating this.
Steps: When I create an illustration or import an illustration and then run Export As or Export for Screens the SVG file it generates is not including the encoding tag.
Expected result: Fully qualified SVG file.
Actual result: Incomplete SVG file.
Why it matters: When trying to embed svg files in a web page through <img src="svg-file.svg"> or <embed> browsers fail to load the file as an asset when the <xml> encoding tag is missing.
Yes the Save As route worked. It does include the encoding tag. So the question now is…why don't the other export options included the xml encoding tag when they are probably the more common workflows for exporting assets for web and screens?
Hitesh Sharma commented
Seems to be typo mistake, since latest update is 22.0.1 not 21.0.1,
Could you please try save as svg route since export route didn't had this tag previously as well.