Question Decode cyrillic string (RFC 1522)


Sep 10, 2012
Programming Experience
Hi all,

I hope you can help me how I can resolve this using VB.NET

From a third-party tool I receive a string which is originally in cyrillic (koi8-r)

The string is always written in this format:

"=?" charset "?" encoding "?" encoded-text "?="

This standard comes from the definition of RFC 1522

One string I have to decode can look like this:


The encoding "Q" mixes readable text with encoded characters like "CE".
How can I retreive the correctly decoded string by use of VB.NET?

Thank you so much in advance,
I recommend Regex to find the encoded-word pattern and extract the charset part and the text part, and the Q/B part if you need it. With charset you can get an Encoding object. Then I would use Regex again to replace all '=XX' entities with the relevant characters. As for the hexadecimal values, like "CE", you must parse that string into a Byte value using Byte.Parse method and use that value as input for the encodings GetString method.
Hi John,

Thank you, this sounds good. The Extraction of the Byte Values is fine for me. But could you show me how you would solve the parsing in code?