- import java.io.UnsupportedEncodingException;
- public class Utf8ToChinese {
- public static void main(String[] args) {
- String strUtf8 = "\\u4e2d\\u56fd\\u4f01\\u4e1a\\u5bb6\\u6742\\u5fd7";
- String strChinese = null;
- try {
- strChinese = new String(strUtf8.getBytes("UTF-8"), "utf-8");
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- strChinese = "decode error";
- }
- System.out.println(strChinese);
- }
- }
- //该片段来自于http://www.codesnippet.cn/detail/2705201512677.html
来源: http://www.codesnippet.cn/detail/2705201512677.html