Gmail IMAP Folders in Different Languages

I had a project where I needed to retrieve messages from my IMAP mailbox of my Bulgarian gmail.  The problem is that I didn’t know what to call it or how to figure out what to call it.  I tried the equivilent in English “All Mail”, folder not found.  I tried the name of the mailbox in Bulgarian in UTF-8 “Цялата поща”, that just gave an error.  I found out that there is some sort of encoding for IMAP for international boxes from a bug report for Thunderbird, a great open-source email client.  It said that I needed to look at RFC3501 to see the standard for how the mailbox should be encoded.  It turns out that it’s a variant of UTF-7, the 7-bit universal format. Continue reading