Unicode Folder Names Support

Horacio Sanson hsanson at gmail.com
Mon Mar 22 10:06:43 GMT 2010


On Sun, Mar 21, 2010 at 09:58:13PM -0700, Dominic LoBue wrote:
> On Sun, Mar 21, 2010 at 4:18 AM, Horacio Sanson <hsanson at gmail.com> wrote:
> >
> >
> >
> > On Sun, Mar 21, 2010 at 12:15:57PM +0900, Horacio Sanson wrote:
> >>
> >> I just started using offlineimap and I can tell my mutt client is
> >> lighting fast. There is just a single problem, that I have Japanese
> >> named folders and they look like: "&MLkwrTDrMKIwwzDXMLgw4zDRMPM-"
> >>
> >> This is a known problem, see here:
> >> http://software.complete.org/software/issues/show/102
> >>
> >> I was looking at the documentation and found the nametrans option rather
> >> interesting. I new to offlineimap and I have no idea about python so I
> >> would like to ask the experts, before I delete my IMAP folders, if it is
> >> possible to use this feature to convert the garbled folder names to
> >> something that mutt can display correctly?
> >>
> >> Something like (remember I have no clue how to use Python):
> >>
> >> nametrans = lambda foldername: re.sub('any folder', 'to_utf8(foldername)', foldername)
> >>
> >
> > I got something working that fixed my problem, see link below for
> > details, but is an ugly hack that requires modification of the
> > offlineimap python code to add conversion from the IMAP4 UTF-7 encoding to
> > UTF-8 encoding.
> >
> > I would like to get some help here to integrate my code better with
> > offlineimap. The ideal would be to convert all IMAP folder names from
> > UTF-7 to a default, maybe UTF-8, encoding when manipulating local
> > repositories.  Even more ideal would be to add an option to the
> > configuration file that would allow users to select their desired
> > encoding to handle all folders in the local repository.
> >
> > I am afraid my python knowledge is below zero but no so my programming
> > skill. All I need to know is exactly were is the best place to add my
> > UTF-7 to UTF-8 coversion code and where is the best place to perform the
> > conversion without breaking the folderfilter and nametrans mechanisms. or
> > any other part of offlineimap.
> >
> > Here is a blog post on my little solution:
> > http://piao-tech.blogspot.com/2010/03/get-offlineimap-working-with-non-ascii.html
> >
> >
> > _______________________________________________
> > OfflineIMAP-project mailing list
> > OfflineIMAP-project at lists.alioth.debian.org
> > http://lists.alioth.debian.org/mailman/listinfo/offlineimap-project
> >
> > OfflineIMAP homepage: http://software.complete.org/offlineimap
> >
> 
> Horacio,
> 
> I'm glad you found a solution that works for you.
> 
> I am working on a rewrite of OfflineIMAP and I will definitely keep
> your suggestions in mind, and do what I can to make sure that UTF-8
> encoding works "out of the box".
> 

That would be great... 

> To answer your question, the best place for the code snippets you
> listed in your blog post would be in separate config file that you
> would then include using the pythonfile setting. Here's a copy of the
> default configuration file fully annotated:
> http://software.complete.org/software/repositories/entry/offlineimap/offlineimap.conf
> 
> The specific setting I'm speaking of is:
> # You can give a Python source filename here and all config file
> # python snippets will be evaluated in the context of that file.
> # This allows you to e.g. define helper functions in the Python
> # source file and call them from this config file.  You can find
> # an example of this in the manual.
> #
> # pythonfile = ~/.offlineimap.py
>

Thanks a lot!, now my solution works without having to modify
offlineimap source.


> I believe this will do what you want.
> 
> -- 
> Dominic LoBue

-- 
regards,
Horacio Sanson




More information about the OfflineIMAP-project mailing list