xcf export fails if file or layer names contain non-ASCII characters

Bug #1200399 reported by Guillermo Espertino (Gez)
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Low
jazzynico

Bug Description

XCF export seems to fail when spaces or special non-US-ASCII characters are used for the name of layers or file.
My locale is spanish, where the use of accented vowels and ñ is very common, and that's what appears to keep the xcf export script from working correctly.
In 0.48.4 it just does nothing (it doesn't save anything and it doesn't show any error messages in the UI or the console).
In 0.48+devel an error message is displayed:

Traceback (most recent call last):
  File "gimp_xcf.py", line 271, in <module>
    e.affect()
  File "/opt/inkscape-devel/share/inkscape/extensions/inkex.py", line 267, in affect
    self.effect()
  File "gimp_xcf.py", line 235, in effect
    f.write(script_fu)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xed' in position 1351: ordinal not in range(128)

The workaround is very easy, it's only matter of changing the name of the offending elements removing all non-ascii characters, and the file is created properly.

Tags: exporting xcf
Revision history for this message
Guillermo Espertino (Gez) (gespertino-gmail) wrote :
description: updated
description: updated
description: updated
description: updated
su_v (suv-lp)
tags: added: exporting layers xcf
tags: removed: layers
Revision history for this message
su_v (suv-lp) wrote :

Reproduced with Inkscape 0.48+devel r12415 on OS X 10.7.5, Python 2.7.5, GTK+/Quartz 2.24.19:
exporting of the provided sample SVG file to GIMP XCF (GIMP 2.8.6 installed) fails with this error message:

Traceback (most recent call last):
  File "gimp_xcf.py", line 271, in <module>
    e.affect()
  File "/Volumes/magenta/mp-trunk/src/inkscape-repo/mptrunk-quartz/inst/share/inkscape/extensions/inkex.py", line 267, in affect
    self.effect()
  File "gimp_xcf.py", line 235, in effect
    f.write(script_fu)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u0301' in position 1832: ordinal not in range(128)

Changed in inkscape:
status: New → Confirmed
description: updated
jazzynico (jazzynico)
Changed in inkscape:
status: Confirmed → Triaged
assignee: nobody → JazzyNico (jazzynico)
Revision history for this message
jazzynico (jazzynico) wrote :

Patch tested on Crunchbang Waldorf (Debian stable), Inkscape trunk revision 12710.

Changed in inkscape:
status: Triaged → In Progress
milestone: none → 0.49
Revision history for this message
jazzynico (jazzynico) wrote :

Also tested successfully on Windows XP, and committed revision 12715.

Changed in inkscape:
status: In Progress → Fix Committed
Changed in inkscape:
status: Fix Committed → Fix Released
Revision history for this message
Hachmann (marenhachmann) wrote :

This still happens in trunk for me (and in 0.91).
Should this report be reopened? Or does it qualify as a regression?

Traceback (most recent call last):
  File "gimp_xcf.py", line 284, in <module>
    e.affect()
  File "/usr/share/inkscape/extensions/inkex.py", line 283, in affect
    self.effect()
  File "gimp_xcf.py", line 248, in effect
    f.write(script_fu.encode('utf-8'))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 697: ordinal not in range(128)

Revision history for this message
Hachmann (marenhachmann) wrote :

(The offending layer was named 'Hände', as reported in the German forum here: https://www.inkscape-forum.de/index.php?p=/discussion/4693/speichern-als-gimp-xcf-ebenen-beibehalten-unter-windows-10)

Revision history for this message
jazzynico (jazzynico) wrote :

@Maren - This is indeed a regression (introduce when trying to fix the current report...).
A patch is in progress.
Thanks!

Revision history for this message
jazzynico (jazzynico) wrote :

Follow-up report: bug #1633999 "xcf export fails if layer names contain non-ASCII characters".

Revision history for this message
Hachmann (marenhachmann) wrote :

Thank you! I'll pass on the good news to the user in the forum, too :)

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.