saved SVG is not well-formed

Bug #244940 reported by anatoly techtonik
6
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
High
Unassigned
Nominated for Old by Luke V

Bug Description

Attached SVG file was saved by Inkscape 0.46, but it can't be read neither by Inkscape nor FF or other programs. Because it contains invalid symbol at Line Number 229, Column 69. I guess that this symbol got there as a result of copy-paste operation, but was not escaped during save operation.

Revision history for this message
anatoly techtonik (techtonik) wrote :
Revision history for this message
sas (sas-sas) wrote :

Confirmed in SVN revision 19107.

The invalid character is U+001A. The bug can be reproduced by copying and pasting this character into a text object in Inkscape, and then saving.

The character needs to be removed rather than escaped (as it would still be invalid even if escaped).

Changed in inkscape:
status: New → Confirmed
Changed in inkscape:
importance: Undecided → High
milestone: none → 0.47
Revision history for this message
Luke V (lvercimak) wrote :

Confirmed in SVN revision 19574

The XML standard defines the following as valid characters
char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
(Extensible Markup Language (XML) 1.0 (Fourth Edition) paragraph 2.2)
http://www.w3.org/TR/REC-xml/#charsets

The following patch checks for control characters (0x01-0x19 excluding 0x09, 0x0a, and 0x0d) on the pasted text and removes them if necessary. It can be expanded to check for the rest of the gaps in character ranges above if they become a problem (they were left out in favor of speed). By preventing the control characters from comming in off of the paste buffer, files like the above attachment won't get generated.

Revision history for this message
Luke V (lvercimak) wrote :

See attached patch

Changed in inkscape:
status: Confirmed → In Progress
status: In Progress → Fix Committed
status: Fix Committed → In Progress
assignee: nobody → lvercimak
Luke V (lvercimak)
Changed in inkscape:
assignee: lvercimak → nobody
Revision history for this message
Buliabyak-users (buliabyak-users) wrote :

thanks for the patch, committed

Changed in inkscape:
status: In Progress → Fix Released
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.