Saving a file on Inkscape 0.92.2 from an SVG exported from Photoshop causes paths to not be saved/loaded correctly

Bug #1716724 reported by ziyokot
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Invalid
Undecided
Unassigned

Bug Description

I exported a SVG from Photoshop and opened it on Inkscape 0.92.2, after modifying and saving this file on Inkscape and reopening the file on Inkscape, I notice that some paths are missing.

On further inspection, it seems that while saving the paths, Inkscape is not adding the opening and closing tags (< and />) of the path while saving, and sometimes even when those are present the path is not loaded.

The path appears on the XML viewer of Inkscape but since it's not read as being inside an opening and closing tag it can't be edited.

I believe this error happens because of all other data Photoshop saved on the file and it's messing with Inkscape read/save.

Attached is an minimal example from the original SVG that shows the error, it has a single path that won't load on Inkscape visually, but still shows up on the XML viewer.

Inkscape 0.92.2 x64
Windows 10 x64

Revision history for this message
ziyokot (ziyokot) wrote :
Revision history for this message
Patrick Storz (ede123) wrote :

Well, the attached file is invalid (and doesn't render in Firefox either).

The problem is not so much the path but the strange "xpacket" part. If you delete everything surrounded by those "<?xpacket?>" tags the file loads properly.

Unless the original file exported from Photoshop is valid and Inkscape "breaks" it when saving I'd say this is a Photoshop issue...

Revision history for this message
Patrick Storz (ede123) wrote :

I spoke to soon:
It's actually sufficient to remove the (illegal?) UTF-8 character in the "begin" attribute of that "xpacket".

If you attach the original SVG file we can check if Inkscape messed it up or it already was broken.

Revision history for this message
Mc (mc...) wrote :

As per https://www.w3.org/TR/SVG/implnote.html#ErrorProcessing , "The document shall be rendered up to, but not including, the first element which has an error. "

Your error (invalid character) is at the beginning of the file, so nothing is rendered

Revision history for this message
ziyokot (ziyokot) wrote :

Yes, before seeing the comments I have just seen that removing that <?xpacket?> part corrects the issue, I will check if it's Photoshop who is putting this or Inkscape...

Revision history for this message
ziyokot (ziyokot) wrote :

Ok, so what happens is that Photoshop adds the `xpacket` tags, but when Inkscape saves it, it's modified and Inkscape adds the invalid character.

Attached are the original SVG as exported by Photoshop and the one Inkscape saved.

Revision history for this message
Patrick Storz (ede123) wrote :

It almost had me fooled but it seems to be a Photoshop issue after all:
While the attribute begin="" looks empty there is already some kind of special character in the original file!

Truly empty attributes do not cause any issue for Inkscape.

Revision history for this message
Patrick Storz (ede123) wrote :

Further investigation shows it's a byte-order-mark ("" in ANSII)

Revision history for this message
Patrick Storz (ede123) wrote :

P.S. I'm not sure if a BOM is allowed (or reasonable) in attribute values, but at the very least Inbkscape could stop rewriting it.

It seems not to be a libxml2 issue as
"xmllint.exe photoshop.svg -o xmllint.svg"
preserves the BOM, so likely Inkscape is messing with it.

Revision history for this message
grey tomorrow (gtomorrow) wrote :

Closing because INVALID.

If you feel this issue has been unjustly closed, please feel free to open a new issue at https://inkscape.org/report . Thank you.

Closed by: https://gitlab.com/greytomorrow

tags: added: bug-migration
Changed in inkscape:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.