Java string encoding(getBytes not working)

184 Views Asked by At

Now I have a return message in Chinese from API, it used big5 to encode. Unfortunately, my web page used UTF-8, so it cant't show properly.

I google this question many times, so I tried different getBytes function many times, and I don't want to use file system to handle it as far as possible. So can anyone supply an effective solution to me?

My JDK version is 1.7, and sorry that this version can't change in this project.

1

There are 1 best solutions below

0
On

You should be using the encoding/decoding methods present in https://docs.oracle.com/javase/7/docs/api/java/nio/charset/Charset.html