public static void main(String[] args)throws Exception {
String msg="汉字";
byte[] bytes=msg.getBytes("utf-8");
String ms=new String(bytes,0,bytes.length,"utf-8");
System.out.print(ms);
}
源数据是utf-8那么你接收后,依然要按原格式utf-8进行转换才可以。