2016-07-25 1:08 GMT+03:00 Timo Sirainen <t...@iki.fi>: > On 23 Jul 2016, at 13:44, Артем Перекресний <kondy...@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