2 Replies - 7636 Views - Last Post: 10 September 2009 - 08:07 AM Rate Topic: -----

#1 ali_selaidin   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 28
  • Joined: 24-March 09

Decoding quoted-printable

Posted 10 September 2009 - 07:23 AM

Well, yeah i'm not able to decode quoted-printable decoded messages, so i need help. I need to decode quoted-printable email messages. I'm using this code:

Regex hexRegex = new Regex(@"(\=([0-9A-F][0-9A-F]))", RegexOptions.IgnoreCase); 
						value = hexRegex.Replace(value, new MatchEvaluator(HexMatchEvaluator));
						value = value.Replace('_', ' '); 

static string HexMatchEvaluator(Match m)
{
	int dec = Convert.ToInt32(m.Groups[2].Value, 16);
	char character = Convert.ToChar(dec);
	 return character.ToString();
}


That works for 'subject' and 'from' headers, but doesn't work for bodies. I've searched for this on the net and the examples i've found didn't work either. Can someone help me?

Is This A Good Question/Topic? 0
  • +

Replies To: Decoding quoted-printable

#2 JackOfAllTrades   User is offline

  • Saucy!
  • member icon

Reputation: 6246
  • View blog
  • Posts: 24,014
  • Joined: 23-August 08

Re: Decoding quoted-printable

Posted 10 September 2009 - 07:29 AM

A Google search for "quoted-printable C#" brought up this in the first link. Looks like it might be OK.
Was This Post Helpful? 0
  • +
  • -

#3 ali_selaidin   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 28
  • Joined: 24-March 09

Re: Decoding quoted-printable

Posted 10 September 2009 - 08:07 AM

Naah, that sample does not decode the bytes with their original charset. It works only for ascii text. If i have chinese text for example that code cannot decode it. Sorry if i'm wrong but i'm not very familliar with all those encoding things...
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1