From: Timo Sirainen Date: Fri, 28 May 2010 11:22:46 +0000 (+0100) Subject: doveadm fetch: mailbox field value is printed as UTF-8, not mUTF-7. X-Git-Tag: 2.0.beta6~121 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ea1ae54fcfbd8e911978c149f9e7265a45b6380a;p=thirdparty%2Fdovecot%2Fcore.git doveadm fetch: mailbox field value is printed as UTF-8, not mUTF-7. --HG-- branch : HEAD --- diff --git a/src/doveadm/doveadm-mail-fetch.c b/src/doveadm/doveadm-mail-fetch.c index 4a10e956f0..6402373310 100644 --- a/src/doveadm/doveadm-mail-fetch.c +++ b/src/doveadm/doveadm-mail-fetch.c @@ -8,6 +8,7 @@ #include "randgen.h" #include "str.h" #include "message-size.h" +#include "imap-utf7.h" #include "imap-util.h" #include "mail-storage.h" #include "mail-search.h" @@ -43,10 +44,17 @@ struct fetch_field { static int fetch_mailbox(struct fetch_cmd_context *ctx) { const char *value; + unsigned int len; if (mail_get_special(ctx->mail, MAIL_FETCH_MAILBOX_NAME, &value) < 0) return -1; - str_append(ctx->hdr, value); + + len = str_len(ctx->hdr); + if (imap_utf7_to_utf8(value, ctx->hdr) < 0) { + /* not a valid mUTF-7 name, fallback to showing it as-is */ + str_truncate(ctx->hdr, len); + str_append(ctx->hdr, value); + } return 0; }