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" ?>
-
Dave Kaplan commented
I have 2 issues relate to this. It's under review so I wanted to add. The beta version of AI 26.4 16 does not have the export with the XML tag, but version 26.2.1 does.
The problem with 26.2.1 is the export with Use Artboards adds an artboard number to the file name that gets messy and requires the producer to remove in the finder. Fxed in the Beta version, here's a reference to the file name fix. https://illustrator.uservoice.com/forums/333657-illustrator-desktop-feature-requests/suggestions/31723057-when-exporting-an-image-using-artboard-with-a-si
If you all can add that XML tag back on the Beta we'd be in a nice spot for both... no artboard numbers with XML tag.
-
Pauline Lawrey commented
Without this I can't load the SVG files into my CMS, it complains that the "MIME type doesn't match its extension" (Not Wordpress)
-
Anonymous commented
Any news about this? I can't believe this annoying problem is not fixed yet...
-
Therise commented
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 -
Peter commented
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.
-
Jackie commented
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.
-
Dirk Schulze commented
Thanks a lot for the information. We put the matter under review and will add it to our backlog afterwards.
-
Anonymous commented
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.
-
Dirk Schulze commented
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.
Greetings,
Dirk -
Anonymous commented
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?
-
Hello Taylor,
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,
Dirk -
Hitesh Sharma commented
Hi Taylor,
we are investigating this.Regards,
Hitesh -
Taylor commented
Version: 22.0.1
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
Hi Taylor,
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.Regards,
Hitesh Sharma