This project is read-only.

Encoding stuff

Apr 12, 2009 at 2:47 PM
Hi,
I have used your code for IMAP communicating. It works just fine.
I used it to connect to gmail and aol services and have encountered one behavior. From header sometimes shows name of sender not in ASCII encoding but in the way like: =?UTF-8?B?0Y3RgtC+INGP?=
I have understood that it shows me name in UTF-8 encoding but how to convert it? I have googled it and didn't find any answer on it. But after thinking more about have understood that: all information is stored in this message. First goes incoding, in my way it is UTF-8. after it goes some parameter B - i think this is shortcut for bytes. and after it goes the string: 0Y3RgtC+INGP
I have figured out that this is bytes of Base64Encoded string. So to get actual UTF-8 string we should do the following:

Encoding.UTF8.GetString(Convert.FromBase64String("0Y3RgtC+INGP"));

Hope someone will see it helpfull.
Thanks,
Alexey.