Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Support for non-UTF8 filesystems

2010-08-23
2013-05-23
  • Matthieu Weber
    Matthieu Weber
    2010-08-23

    Hi,

    My filesystem is still in latin1, and all the comics I have stored on CDs use latin1 encoding for the file names and directory names. When automatically creating a new collection from a non-UTF8 directory, comix chokes on the non-UTF8 string. Here is a small patch that keeps UTF8 directory names as is, but converts latin1 directory names to UTF8 collection names. It's not much, and I may improve the non-UTF8 support as I go on using comix (I'm new to it).

    --- filechooser.py.orig 2009-04-03 20:06:13.000000000 +0300
    +++ filechooser.py  2010-08-23 17:55:12.000000000 +0300
    @@ -10,6 +10,7 @@
     import labels
     from preferences import prefs
     import thumbnail
    +import locale
     _main_filechooser_dialog = None
     _library_filechooser_dialog = None
    @@ -261,6 +262,13 @@
             directory.
             """
             name = os.path.basename(self.filechooser.get_current_folder())
    +        try:
    +          name = unicode(name, 'utf-8')
    +        except UnicodeDecodeError:
    +          try:
    +            name = unicode(name, locale.getdefaultlocale()[1])
    +          except UnicodeDecodeError:
    +            pass
             self._comboentry.child.set_text(name)
         def files_chosen(self, paths):