html entities in attributes in extension output are expanded

Bug #1804346 reported by Lex Neva
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
New
Undecided
Unassigned

Bug Description

If an extension includes an HTML entity such as 
 (newline) in a tag attribute, Inkscape expands the entity, rather than keeping it intact.

Steps to reproduce:

1. Create an extension that creates a new <svg:path> element with an attribute "foo", with value "hello\nworld".
2. Run the extension.
3. Examine the new <svg:path> element in the XML editor.
4. Save the SVG.

Observed results:

In the XML editor and in the file on disk, the "foo" attribute has an actual newline in it, which is not valid. When next you run an extension on the file, Python's lxml will convert the newline to a space character. I'm guessing that's because a newline is not valid in an XML attribute, or all whitespace is compressed to a single space.

Expected results:

Inkscape should retain the &#10; in the attribute.

Why does this matter? One problem is that interpolating an entity-encoded quotation mark character will result in invalid XML. More practically, my extension Ink/Stitch (inkstitch.org) makes extensive use of additional XML attributes to store extra information. I'm going to have to base64-encode the data to ensure it round-trips correctly.

Inkscape version: 0.92.3+68~ubuntu17.10.1

Ubuntu 18.04.1 LTS

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.