zhyiwww
          用平實的筆,記錄編程路上的點點滴滴………
          posts - 536,comments - 394,trackbacks - 0
          ?public static String getUniStr(String str)
          ?{
          ??StringBuffer uniString = new StringBuffer();
          ??for (int i = 0; i < str.length(); i++)
          ??{
          ???Character ch = new Character(str.charAt(i));
          ???if (ch.toString().getBytes().length == 1)
          ???{
          ????uniString.append(ch.charValue());
          ???}
          ???else
          ???{ // double bytes character: Chinese
          ????int a = (int) ch.charValue();
          ????String tmp = new String("&#x" + Integer.toHexString(a) + ";");
          ????uniString.append(tmp);
          ???}
          ??}
          ??return uniString.toString();
          ?}

          |----------------------------------------------------------------------------------------|
                                     版權聲明  版權所有 @zhyiwww
                      引用請注明來源 http://www.aygfsteel.com/zhyiwww   
          |----------------------------------------------------------------------------------------|
          posted on 2006-07-11 17:35 zhyiwww 閱讀(2078) 評論(2)  編輯  收藏 所屬分類: java basic

          FeedBack:
          # re: 如何將字符串轉換成Unicode編碼
          2006-11-01 09:45 | happylu
          getBytes+指定字符集不就可以嗎?  回復  更多評論
            
          # re: 如何將字符串轉換成Unicode編碼
          2006-11-01 19:33 | zhyiwww
          這里指的是實現字符集轉換的細節,是詳細的實現過程,當然那種方法也能實現的.  回復  更多評論
            
          主站蜘蛛池模板: 吉木萨尔县| 宁海县| 海丰县| 彭泽县| 新竹市| 福安市| 黄平县| 台东市| 彩票| 林口县| 渝中区| 镇原县| 清水县| 阳高县| 奇台县| 巴里| 扶余县| 侯马市| 凉城县| 道孚县| 虞城县| 左权县| 丹巴县| 蓬莱市| 阿瓦提县| 宁远县| 灵丘县| 沂水县| 夏河县| 济阳县| 贵南县| 涿州市| 康马县| 萝北县| 永善县| 闻喜县| 侯马市| 大名县| 双鸭山市| 明光市| 宁波市|