Java下unicode转换为utf-8

参考自: http://stackoverflow.com/questions/4184108/python-json-dumps-cant-handle-utf-8

try {
    String s1 = "\u5e7f\u5c9b\u4e4b\u604b.mp3";
    byte[] converttoBytes = s1.getBytes("UTF-8");
    String s2 = new String(converttoBytes, "UTF-8");
    System.out.println(s2);
} catch (Exception e) {
	e.printStackTrace();
}

会输出:

广岛之恋.mp3





你可能感兴趣的:(java,unicode)