Phatch can't handle always filenames with unicode and spaces

Bug #533068 reported by Stani
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Phatch
Fix Released
High
Stani

Bug Description

Error 3:Can not apply action Save on image 'éxif ïptc.jpg' in folder:
/home/nadia/projects/phatch/tests/input

('ascii', 'TIFFOpen: /home/nadia/projects/phatch/tests/output/images/\xc3\xa9xif: Cannot open.\n', 58, 59, 'ordinal not in range(128)')

Action:{'fields': {'As': u'tif',
            'File Name': u'<filename>_save_As=tif_TIFFCompression=zip',
            'In': u'/home/nadia/projects/phatch/tests/output/images',
            'JPEG Quality': u'85',
            'JPEG Size Maximum': '0kb',
            'JPEG Size Tolerance': '5%',
            'Metadata': 'no',
            'PNG Optimize': 'no',
            'Resolution': u'<dpi>',
            'Show Type Options': 'no',
            'TIFF Compression': u'zip',
            '__enabled__': 'yes'},
 'label': 'Save'}

Traceback (most recent call last):
  File "/home/nadia/projects/phatch/phatch/core/api.py", line 617, in apply_action_to_photo
    photo = action.apply(photo, read_only_settings, cache)
  File "/home/nadia/projects/phatch/phatch/actions/save.py", line 159, in apply
    save_metadata=save_metadata, **options)
  File "/home/nadia/projects/phatch/phatch/core/pil.py", line 595, in save
    compression=compression, **options))
  File "/home/nadia/projects/phatch/phatch/lib/openImage.py", line 286, in save_libtiff
    % (input, out, err)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 58: ordinal not in range(128)
*

actionlist: /home/nadia/projects/phatch/tests/output/actionlists/convert_mode_save_Mode=1_As=im.phatch
Error 0:Can not apply action Save on image 'éxif ïptc.jpg' in folder:
/home/nadia/projects/phatch/tests/input

'ascii' codec can't encode character u'\xe9' in position 54: ordinal not in range(128)

Action:{'fields': {'As': u'im',
            'File Name': u'<filename>_convert_mode_save_Mode=1_As=im',
            'In': u'/home/nadia/projects/phatch/tests/output/images',
            'JPEG Quality': u'85',
            'JPEG Size Maximum': '0kb',
            'JPEG Size Tolerance': '5%',
            'Metadata': 'yes',
            'PNG Optimize': 'yes',
            'Resolution': u'<dpi>',
            'Show Type Options': 'no',
            'TIFF Compression': u'<compression>',
            '__enabled__': 'yes'},
 'label': 'Save'}

Traceback (most recent call last):
  File "/home/nadia/projects/phatch/phatch/core/api.py", line 617, in apply_action_to_photo
    photo = action.apply(photo, read_only_settings, cache)
  File "/home/nadia/projects/phatch/phatch/actions/save.py", line 159, in apply
    save_metadata=save_metadata, **options)
  File "/home/nadia/projects/phatch/phatch/core/pil.py", line 550, in save
    **options)
  File "/home/nadia/projects/phatch/phatch/lib/imtools.py", line 963, in save_check_mode
    save(image, filename, **options)
  File "/home/nadia/projects/phatch/phatch/lib/imtools.py", line 956, in save
    image.save(filename, **options)
  File "/usr/lib/python2.6/dist-packages/PIL/Image.py", line 1439, in save
    save_handler(self, fp, filename)
  File "/usr/lib/python2.6/dist-packages/PIL/ImImagePlugin.py", line 319, in _save
    fp.write("Name: %s\r\n" % filename)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 54: ordinal not in range(128)
*

Stani (stani)
Changed in phatch:
importance: Undecided → High
milestone: none → 0.2.7
status: New → Confirmed
Stani (stani)
summary: - Phatch can't handle unicode sometimes
+ Phatch can't handle always filenames with unicode and spaces
Stani (stani)
Changed in phatch:
assignee: nobody → stani (stani)
status: Confirmed → In Progress
Revision history for this message
Stani (stani) wrote :
Changed in phatch:
status: In Progress → Fix Committed
Revision history for this message
Stani (stani) wrote :

The fix broke support for svg. I'll fix it.

@nadia: we should have a svg file in the input folder

Changed in phatch:
status: Fix Committed → In Progress
Revision history for this message
Stani (stani) wrote :
Changed in phatch:
status: In Progress → Fix Committed
Stani (stani)
Changed in phatch:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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