[Dovecot] UTF-8 mailbox name STATUS response

Ewald Dieterich ewald.lists at fun.de
Mon Jul 2 14:06:19 EEST 2012


On 07/02/12 11:25, Timo Sirainen wrote:
 > On 2.7.2012, at 12.07, Ewald Dieterich wrote:
 >> STATUS in Dovecot 2.1.7 returns the UTF-8 decoded folder name in a
 >> string literal:
 >>
 >> . CREATE "INBOX.Euro &IKw-"
 >> . OK Create completed.
 >> . LIST "" "INBOX.Euro &IKw-"
 >> * LIST (\HasNoChildren) "." "INBOX.Euro &IKw-"
 >> . STATUS "INBOX.Euro &IKw-" (MESSAGES)
 >> * STATUS {14}
 >> INBOX.Euro € (MESSAGES 0)
 >> . OK Status completed.
 >>
 >> Is this intended? My Perl script based on Mail::IMAPTalk doesn't like
 >> it and I wonder if there are other clients that don't cope with it.
 >
 > Most likely that mailbox exists like that in the filesystem. It
 > shouldn't. Dovecot hasn't allowed creating those for several years
 > now.

In the filesystem the mailbox is in mUTF-7:

# ls mailboxes/
Euro &IKw-/  INBOX/  Trash/

 > There's no good way to handle that, because even if Dovecot
 > translated it to mUTF-7 it couldn't access the mailbox because it
 > wouldn't exist as mUTF-7 in the filesystem..

To create the LIST response from my example above you do exactly this:
convert the mailbox name to mUTF-7.

. LIST "" "INBOX.Euro &IKw-"
* LIST (\HasNoChildren) "." "INBOX.Euro &IKw-"

In file imap/cmd-list.c:

static int
list_namespace_mailboxes(struct cmd_list_context *ctx)
[...]
     if (imap_utf8_to_utf7(name, mutf7_name) < 0)
         i_panic("LIST: Mailbox name not UTF-8: %s", name);
[...]
     imap_quote_append_string(str, str_c(mutf7_name), FALSE);

So maybe you could do this for the STATUS response, too?

Thanks for your help!


More information about the dovecot mailing list