http://expert.csdn.net/Expert/topic/2377/2377879.xml?temp=5.103701E-02

解决方案 »

  1.   


    Buffer=Integer.toHexString((int)UnCodeMsgString.charAt(i)&0XFFFF);
    UnCodeMsgString是一个汉字的句子,如“节日快乐”。
      

  2.   

    Buffer=Integer.toHexString((int)UnCodeMsgString.charAt(i)&0XFFFF).toUpperCase();
    把转换成的十六进制数用大写字母表示;
    UnCodeMsgString是一个汉字的句子,如“节日快乐”。
      

  3.   

    将中文字符转化为unicode串;
      1。将字符赋值给一个int变量;
           char a='中';
           int codeNum=a;
      2。将int变量转化为Integer;
          Integer codeNumO=new Integer(codeNum);
      3.调用Integer的转换工具方法:
         String hexCode=codeNumO.toHexString();
         hexCode="\\u"+hexCode;
         system.out.println("the unicode is "+hexCode); 
    反过来转换: