Decoding problems

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Nov 2008
Posts: 2
Reputation: melektaus55 is an unknown quantity at this point 
Solved Threads: 0
melektaus55 melektaus55 is offline Offline
Newbie Poster

Decoding problems

 
0
  #1
Apr 4th, 2009
  1. System.Text.Encoding enc = System.Text.Encoding.Unicode;
  2. byte[] bytes = enc.GetBytes(plainTextContent);
  3. string decodedText = Encoding.GetEncoding(charset).GetString(bytes);

"charset" is ISO-8859-1. If i use Unicode encoding, the GetString() method returns only the first character of bytes[], if i use ASCII or UTF-8 encoding i get all characters but there are some characters that are represented with "?"(so, GetString is unable to decode them). So i have two questions, how do i know which encoding to use, UTF-8, ASCII, Unicode or whatever...The message that i want to decode is the plain text body of an email message. The second question is...well, how to decode these "?" characters?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC