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

Bug #1200399 reported by Guillermo Espertino (Gez) on 2013-07-11
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Inkscape
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.

Related branches

description: updated
description: updated
description: updated
description: updated
su_v (suv-lp) on 2013-07-12
tags: added: exporting layers xcf
tags: removed: layers
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) on 2013-08-13
Changed in inkscape:
status: Confirmed → Triaged
assignee: nobody → JazzyNico (jazzynico)
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
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
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)

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)

jazzynico (jazzynico) wrote :

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

jazzynico (jazzynico) wrote :

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

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  Edit
Everyone can see this information.

Other bug subscribers