richq / folders2flickr

Upload files to flickr
Other
102 stars 38 forks source link

using german umlaute (äöü) in set names #14

Closed MrBovert closed 10 years ago

MrBovert commented 10 years ago

Modul tag2set.py stops when creating a set from a directory with contains german umlaute (vocals with two dots on it like äöü).

Last entry in debug.log: " .... Generating set d:\CamPics\test\2011_Gäste-WC with 1 pictures"

Console says: "UnicodeDecodeError: 'utf8' codec can't decode byte 0xe4 in position 22: invalid continuation byte"

Even if I do not understand this because UTF-8 should be able to handle all characters in the world the following replacement works (on my Win7 PC):

Line 28 in tags2set.py:

old: unicodeSetName = setName.decode('utf-8')

new: encodingType = sys.getfilesystemencoding() unicodeSetName = setName.decode(encodingType)

Remarks:

  1. Not shure if this occures under windows only.
  2. Not shure if this change is backward compatible with exisiting directories So better back up you directory before trying ;-) (Are the set names also stored in the directory?)
richq commented 10 years ago

Oh, nice. That fix - the original decode - was because before in issue #10 directories that were not just plain old ASCII failed to do anything. Linux filesystems are utf-8, I think Windows uses utf-16? but your solution looks to take that into account. I'll test this out and commit it when I can.