As I correctly understand you you are talking about "encoded-words" (RFC
2047) that has the following format:
encoded-word = "=?" charset "?" encoding "?" encoded-text "?="
You should distinguish parsing for different encoding:
q - for quoted printable
b - base64
You can read more information about that formats in RFC2047. For example
base64-encoded text could be transformed back using the following code:
string decodedText =
Encoding.GetEncoding(charset).GetString(Convert.FromBase64String(encoded-text));
Long time ago I was writing .NET POP3 client that has parser of all that
stuff, maybe you can find here some useful code snippets:
http://sf.net/projects/nmailunit/
--
Sergey Bogdanov
http://www.sergeybogdanov.com
Chance Hopkins wrote:
> I have an app that uses a socket to grab some data and ASCII encodes it to
> store in a file.
>
> Some times the data is supposed to be utf8 and start with =?Utf-8? when I
> view it with notepad.
>
> I'm trying to turn it back into the original text like so:
>
> ----------------------------------
>
>
> if(myString.StartsWith("=?Utf-8?"))
> {
>
> //SOMEWHERE IN THESE TWO LINES IS THE ISSUE
>
> byte[] temp = System.Text.ASCIIEncoding.Convert(System.Text.Encoding.UTF8,
> System.Text.Encoding.ASCII,
> System.Text.ASCIIEncoding.ASCII.GetBytes(currentMsg.Subject));
> lblSubject.Text = "Subject: " +
> System.Text.Encoding.ASCII.GetString(temp,0,temp.Length);
>
> temp = null;
> }
> else
> lblSubject.Text = myString;
>
> ----------------------------------
>
> I just don't understand which encoding I have.
>
> When I GetBytes, should it be ascii or utf8? (I think ascii)
>
> When I Convert, am I going from ascii to utf8 or utf8 to ascii?
>
>
> Can someone point me in the right direction, please.
>
> Thanks.
>
>