It is necessary to unload all addresses for the last month that the letters were sent. By IMAP, I get a list of all folders, but the folders named in Cyrillic have names like &BB4EQgQ,BEAEMAQyBDsENQQ9BD0ESwQ1- How can they be recoded so that they can be read?

    1 answer 1

    Google led to the next SO , which says that this encoding is called IMAP UTF-7 .

    It also says that you can decode using IMAPClient :

     from imapclient import imap_utf7 s = b'&BB4EQgQ,BEAEMAQyBDsENQQ9BD0ESwQ1-' # Важно: bytes, а не str result = imap_utf7.decode(s) print(result) # => Отправленные 
    • Obviously I was wrong .. thanks :) - Pavel Durmanov