-2

As i mentioned in the title. For example:

If the input looks like:

FW: Błąd zakładania FA/PA

I would like to receive:

=?utf-8?B?Rlc6IELFgsSFZCB6YWvFgmFkYW5pYSBGQS9QQQ==?=

Thanks for help.

0

1 Answer 1

3

In this specific case Base64 encoded text exists in this MIME encoded string after the B?upto the next ?

string mimed = "=?utf-8?B?Rlc6IELFgsSFZCB6YWvFgmFkYW5pYSBGQS9QQQ==?=";

mimed = mimed.Substring(10, mimed.IndexOf("?", 10) - 10);

string result = Encoding.UTF8.GetString(Convert.FromBase64String(mimed));

The reverse:

result = string.Format("=?utf-8?B?{0}?=", Convert.ToBase64String(Encoding.UTF8.GetBytes(@"FW: Błąd zakładania FA/PA")));
Sign up to request clarification or add additional context in comments.

2 Comments

Thats something that I am looking for. But is it possible to do in reversed direction?
I want to get mimed from result

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.