V
V
Vitaly Gusev2019-05-28 15:47:28
linux
Vitaly Gusev, 2019-05-28 15:47:28

How to detect encoding and re-encode folder names?

Good afternoon!
I have an MDaemon mail server. Everyone who knows him is well aware that there are a number of folders in the mailbox folder - Inbox, Outbox, Deleted, etc. But These folder names look like this - &BB4EQgQ,BEAEMAQyBDsENQQ9BD0ESwQ1-.IMAP . Accordingly, it is very difficult to understand through Windows Explorer which folder you are dealing with. But that's not even the point. I needed to transfer all mail from a Windows server to Linux and adapt it all to Postfix+Dovecot+Roundcube+Postfixadmin+MySQL. I configured this whole bunch, but linux sees these folders with unreadable names in the same way.
5ced2ddda0941507278398.jpeg
First of all, I can't determine the encoding in which the folders are named, secondly, I need to somehow recode them into UTF8.
Look, I found the answer!
1. We take the string " &BB4EQgQ,BEAEMAQyBDsENQQ9BD0ESwQ1- " from our example , remove the symbol " & " at the beginning, and replace " - " with two equals - " == " at the end .
2. The resulting string is decoded using base64.
3. Recode the result from UTF-16BE to UTF-8
Complete crap!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question