Is any proven routine to migrate mailboxes from mUTF-7 to UTF-8 encoding? I've try to use doveadm list/mutf7/rename but have been stuck with nested inboxes. Say I have the next structure: INBOX INBOX.??? INBOX.???.??? encoded for FS respectively as .INBOX .INBOX.&BDYESwRA- .INBOX.&BDYESwRA-.&BE8ENARK- ?When I've try to rename ?INBOX.??? with doveadm mailbox rename -u me -s "INBOX.&BDYESwRA-" $(doveadm mailbox mutf7 -7 "INBOX.&BDYESwRA-") I've get the next: .INBOX .INBOX.??? .INBOX.???.&BE8ENARK- ?Sure when I've try to rename ?.INBOX.???.&BE8ENARK- I've get a message that this is not a valid mUTF7-encoded string. So that is the question.
On 23 Jul 2016, at 13:44, ????? ??????????? <kondybas at gmail.com> wrote:> > Is any proven routine to migrate mailboxes from mUTF-7 to UTF-8 encoding?For what purpose? By default Dovecot assumes that mailboxes are mUTF-7 on filesystem.> I've try to use doveadm list/mutf7/rename but have been stuck with nested > inboxes. Say I have the next structure: > > INBOX > INBOX.??? > INBOX.???.??? > > encoded for FS respectively as > > .INBOX > .INBOX.&BDYESwRA- > .INBOX.&BDYESwRA-.&BE8ENARK- > > ?When I've try to rename ?INBOX.??? with > > doveadm mailbox rename -u me -s "INBOX.&BDYESwRA-" $(doveadm mailbox mutf7 > -7 "INBOX.&BDYESwRA-") > > I've get the next: > > .INBOX > .INBOX.??? > .INBOX.???.&BE8ENARK- > > ?Sure when I've try to rename ?.INBOX.???.&BE8ENARK- I've get a message > that this is not a valid mUTF7-encoded string. > > So that is the question.I don't think there's any especially easy way to do that. You'd need to write a script that properly goes through the hierarchies and does the renaming.
2016-07-25 1:08 GMT+03:00 Timo Sirainen <tss at iki.fi>:> On 23 Jul 2016, at 13:44, ????? ??????????? <kondybas at gmail.com> wrote: > > > > Is any proven routine to migrate mailboxes from mUTF-7 to UTF-8 encoding? > > For what purpose? By default Dovecot assumes that mailboxes are mUTF-7 on > filesystem. > > > I've try to use doveadm list/mutf7/rename but have been stuck with nested > > inboxes. Say I have the next structure: > > > > INBOX > > INBOX.??? > > INBOX.???.??? > > > > encoded for FS respectively as > > > > .INBOX > > .INBOX.&BDYESwRA- > > .INBOX.&BDYESwRA-.&BE8ENARK- > > > > ?When I've try to rename ?INBOX.??? with > > > > doveadm mailbox rename -u me -s "INBOX.&BDYESwRA-" $(doveadm mailbox > mutf7 > > -7 "INBOX.&BDYESwRA-") > > > > I've get the next: > > > > .INBOX > > .INBOX.??? > > .INBOX.???.&BE8ENARK- > > > > ?Sure when I've try to rename ?.INBOX.???.&BE8ENARK- I've get a message > > that this is not a valid mUTF7-encoded string. > > > > So that is the question. > > I don't think there's any especially easy way to do that. You'd need to > write a script that properly goes through the hierarchies and does the > renaming. > >I've thought doveadm behaviour is more straightforward so I've try to keep my sticky hands off the maildir internals. Is any traps with renaming/subscription I have to know?
2016-07-25 1:08 GMT+03:00 Timo Sirainen <tss at iki.fi>:> On 23 Jul 2016, at 13:44, ????? ??????????? <kondybas at gmail.com> wrote: > > Is any proven routine to migrate mailboxes from mUTF-7 to UTF-8 encoding? > ?For what purpose? By default Dovecot assumes that mailboxes are mUTF-7 on > filesystem.? > >??Main idea is to convert FS directories names of the inherited dovecot's v 1.x hierarcy from the mUTF-7 to the readable UTF-8 format?. It's too dizzy to work with directories like .INBOX.&BDYESwRA-.&BE8ENARK-. Also logs are look weird.> I don't think there's any especially easy way to do that. You'd need to > write a script that properly goes through the hierarchies and does the > renaming. >Here is the quick solution:? we have to list mailbox names in the reverse alnum order to be sure nested subdirs will be renamed prior to the upper level ?ones: ?#!/bin/sh doveadm mailbox list -8 -A | sort -r | while read user utf7 do utf8=$( doveadm mailbox mutf7 -7 "$utf7" ) [ $utf7 != $utf8 ] && doveadm mailbox rename -u $user -s "$utf7" "$utf8" done #### ? 1. Stop dovecot 2. Add the "UTF-8" key to the `mail_location = maildir:/path/:UTF-8` 3. Start dovecot. Now all old folders will be shown as plain mUFT7-encoded strings (subscriptions stay correct) 4. Run the script above ?In my case managesieve is already configured to use UTF-8 for sieve rules ?so no additional conversion needed. But if mUTF-7 is used for sieve files `doveadm mailbox mutf7` can be used for conversion. ?Artem?