0

I have a byte array that needs decoding into a string. However, I don't know the format of the string - UTF-8, UTF-16, etc.

What's the most effective way to decode the byte array in .Net? Or is trial and error the only real solution?

jimbo
  • 603
  • 9
  • 27
  • Let's make it `educated trial and error` ;-) – TaW Jul 10 '18 at 08:12
  • 2
    There *is* no real solution. A single byte array may represent valid but different text in multiple different encodings. If you don't have information about what the original encoding was, you can't work out what the original string was. – Jon Skeet Jul 10 '18 at 08:29
  • The __various__ answers __and__ comments in the link should cover all aspects of the question. – TaW Jul 10 '18 at 08:39

0 Answers0