Handle non-UTF8-encoded file paths more gracefully.
authorJoel Rosdahl <joel@rosdahl.net>
Sat, 31 Jul 2004 12:31:33 +0000 (12:31 +0000)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 31 Jul 2004 12:31:33 +0000 (12:31 +0000)
src/gkofoto/registerimagesdialog.py

index b8f9bd1..4c161cb 100644 (file)
@@ -35,7 +35,11 @@ class RegisterImagesDialog(gtk.FileSelection):
         images = []
         for filepath in walk_files(self.get_selections()):
             try:
-                image = env.shelf.createImage(filepath.decode("utf-8"))
+                try:
+                    filepath = filepath.decode("utf-8")
+                except UnicodeDecodeError:
+                    filepath = filepath.decode("latin1")
+                image = env.shelf.createImage(filepath)
                 images.append(image)
                 newImages += 1
                 newImagesCount.set_text(str(newImages))