Menu

#47 Encode and decode mailbox names from modified UTF7

1.3.1
fixed
None
1.5.0
5
2022-06-20
2019-06-22
hello world
No

IMAP mailbox names fully support Unicode but use a rather exotic ASCII-safe modified UTF7 encoding.
See https://tools.ietf.org/html/rfc3501#section-5.1.3

Having local directories (Maildir) named as
&BB4EQgQ,BEAEMAQyBDsENQQ9BD0ESwQ1-
&BB4EQgQ,BEAEMAQyBDsENQQ9BD0ESwQ1-.takoe
&BB4EQgQ,BEAEMAQyBDsENQQ9BD4-
...makes no sense and is almost unusable.

isync should support re-encoding mailbox names when storing them as directories on local filesystem.
If I have some time I could implement it myself, however I'm quite busy right now and I wouldn't really know where to start.

Discussion

  • Oswald Buddenhagen

    • status: reported --> open
    • assigned_to: Oswald Buddenhagen
     
  • Rostislav

    Rostislav - 2019-10-25

    Thanks for the great tool! I had to make a workaround by using channels to map remote UTF7 names to local UTF8.

    It would be indeed great to make the concersion transparant, so I join the feature request. Just in case, the implementation of the conversion itself can be found e.g. in mutt source code
    https://gitlab.com/muttmua/mutt/blob/master/imap/utf7.c

     
  • Daniel Gray

    Daniel Gray - 2019-11-03

    I had this issue with a directory that was a person's name. It contains a ł character.

    Instead isync when it pulls down the folder shows it as &AUI-

    This is really annoying because I have a heap of folders I created in Thunderbird where I copied the person's name from their To: header.

     
  • Max Gautier

    Max Gautier - 2020-04-27

    I took look at the code to see if I had some idea on how to accomplish that (Yeah, not having my diacritics correctly annoys me ^)
    drv_imap.c looks like the place to start, but I'm not sure which functions should be modified to deal with encoded mailbox names.
    I guess the one in driver.h which deal with mailboxes.
    If anyone has pointers, I'll be glad to hear them.

    (As far as I can tell the conversion itself does not seem complicated, provided it use iconv).

     
  • Oswald Buddenhagen

    parse_list_rsp_p2() should be the only one that needs decoding.
    for encoding, it might make sense to add a new conversion to imap_vprintf(), either a new flag to %s (e.g. %^s) or a new conversion specifier (e.g. %S) (i'd favor the former).

     
  • Max Gautier

    Max Gautier - 2020-04-29

    I'm starting to have something. What's the best channel to continue the discussion and send patches ?

     
  • Oswald Buddenhagen

    traditionally the mailing list.

     
  • Roland Puntaier

    Roland Puntaier - 2020-05-12

    When is this planned for release?

     

    Last edit: Roland Puntaier 2020-05-12
  • Oswald Buddenhagen

    i had entirely forgotten about it, but there is a MR at https://sourceforge.net/p/isync/isync/merge-requests/3/ :}
    instead of modifying imap_printf() it concentrates the logic in prepare_name(). it does so incorrectly (it forgets about the prefix; fixable by doing the encoding after the concatenation) and LIST is not covered at all (fixable by using prepare_name() with "*" for the name), but the approach is arguably less cryptic and even more efficient (the same box name isn't re-encoded for every STOREd message).

     
  • Oswald Buddenhagen

    • status: open --> fixed
    • Fixed In: unknown --> 1.5.0
     
  • Oswald Buddenhagen

    commit 52c063fd4 in master fixes this.
    there is also efab63fb8 which enables utf-8 support.

     

Log in to post a comment.