0

I'm receiving a byte[] of information in an unspecified encoding format. Is there a way to convert it to a String without knowing the character encoding?

the_camino
  • 356
  • 5
  • 18
  • 1
    See [Guessing the encoding of text represented as byte\[\] in Java](http://stackoverflow.com/questions/1677497/guessing-the-encoding-of-text-represented-as-byte-in-java). Almost a duplicate and certainly will help. – Duncan Jones Jun 19 '14 at 15:03
  • Glad it helped. It's not a perfect duplicate, but since it answered your question and is very closely related, I'm happy to close this question. – Duncan Jones Jun 20 '14 at 07:32

1 Answers1

1

The tool of choice is CharsetMatch from ICU: http://userguide.icu-project.org/conversion/detection

It is not an exact science, so there is a confidence score that you have to watch and it will take some experimentation, but will definitely get you where you want to go. Good Luck!

Ryan Goltry
  • 106
  • 5