title: C#: Converting byte[] to UTF8 encoded string
body: <p>I am using a library called <a href="http://www.codeproject.com/KB/graphics/exifextractor.aspx" rel="noreferrer">EXIFextractor</a> to extract metadata information from images. This lib in part is using <em>System.Drawing.Imaging.PropertyItem</em> to do all the hard work. Some of the data in PropertyItem, such as Image Details etcetera, are fetched as an ASCII-string stored in a byte[] according to the Microsoft documentation. </p>
  
  <p>My problem is that international characters (å, ä, ö, etcetera) are dropped and replaced by questionmarks. When I debug the code it is apparent that the byte[] is a representation of an UTF-8. </p>
  
  <p>I'd like to parse the byte[] as an UTF8-string, how can I do this without loosing any information in the process? </p>
  
  <p>Thanks in advance!</p>
  
  <hr>
  
  <p><strong>Update:</strong></p>
  
  <p>I have been asked to provide a snippet from my code:</p>
  
  <p>The first snippet is from the class I use, namely the <em>EXIFextractor.cs</em> written by Asim Goheer</p>
  
  <pre><code>foreach( System.Drawing.Imaging.PropertyItem p in parr )
  {
   string v = ""; 
  
                  // ...
  
   else if( p.Type == 0x2 )
   {
    // string     
    v = ascii.GetString(p.Value);
   }
  </code></pre>
  
  <p>And this is my code where I try my best to handle the results of the above.</p>
  
  <pre><code>                try {
    EXIFextractor exif = new EXIFextractor(ref bmp, "");
    object o;
                      if ((o = exif["Image Description"]) != null)
                          MediaFile.Description = Tools.UTF8Encode(o.ToString()); 
  </code></pre>
  
  <p>I have also tried a couple of other ways of getting my precious å, ä, ö from the data, but nothing seems to do the trick. I am starting to think Hans Passant is right about his conclusions in his answer below. </p>