Re: [Dovecot] UTF-8 mailbox name STATUS response

2012-07-02 Thread Timo Sirainen
On 2.7.2012, at 14.06, Ewald Dieterich wrote:

> >> . 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:

Oh, sorry. I didn't even consider that it could have been broken for this long 
in v2.1.x without anyone noticing. Fixed:
http://hg.dovecot.org/dovecot-2.1/rev/a698fccd37c3

Time for v2.1.8 soon I guess :)

Re: [Dovecot] UTF-8 mailbox name STATUS response

2012-07-02 Thread Ewald Dieterich

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!


Re: [Dovecot] UTF-8 mailbox name STATUS response

2012-07-02 Thread Timo Sirainen
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. 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..



[Dovecot] UTF-8 mailbox name STATUS response

2012-07-02 Thread Ewald Dieterich

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.