UTF-8 to Java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

UTF-8 to Java

Is there any way I can turn the UTF-8 language to Java? If so, how? If not, then is there any way I can read the UTF-8 encoding?

18th Apr 2017, 12:57 PM
Anmol
1 Answer
+ 22
String objects in Java don't have an encoding (*). The only thing that has an encoding is a byte. So if you need UTF-8 data, then you need a byte. If you have a String that contains unexpected data, then the problem is at some earlier place that incorrectly converted some binary data to a String (i.e. it was using the wrong encoding). (*) that's not entirely accurate. Actually they have an encoding, but that's UTF-16 and can't be modified.
18th Apr 2017, 2:44 PM
No Name