IMAP folder names conversion utility
If you've encountered folder names like A5EDwQPHA7UDrwO,-
in your mailbox after a mail server migration, you can convert them back with this shell pipe:
echo 'FOLDER_NAME' | tr "&" "+" | tr "," "/" | iconv -f UTF-7 -t UTF-8
Obviously, you'll have to change the FOLDER_NAME
string. e.g.:
echo '&A5EDwQPHA7UDrwO,-' | tr "&" "+" | tr "," "/" | iconv -f UTF-7 -t UTF-8
Αρχείο
I've also created a PHP Script that does the same thing utilizing the mb_convert_encoding()
function:
<html>
<head>
<title>IMAP UTF7 to UTF8 converter</title>
</head>
<body>
<form method="POST" action="">
<input type="text" name="imap7">
<input type="submit" value="Convert">
</form>
<?php
if (isset($_POST['imap7'])) {
echo mb_convert_encoding($_POST['imap7'], "UTF8", "UTF7-IMAP");
}
?>
</body>
</html>