java,php,asp.net,linux,javascript,mysql,mssql,oracle,编程

Big5字与Unicode的互换

转载请注明:http://www.pmjava.com/Article/ShowInfo.asp?ID=56582
import java.io.*;

public class MyUtil{
   
public static String big5ToUnicode(String s){
       
try{
           
return new String(s.getBytes("ISO8859_1"), "Big5");
        }
       
catch (UnsupportedEncodingException uee){
           
return s;
        }
    }

   
public static String UnicodeTobig5(String s){
       
try{
           
return new String(s.getBytes("Big5"), "ISO8859_1");
        }
       
catch (UnsupportedEncodingException uee){
           
return s;
        }
    }

   
public static String toHexString(String s){
        String str
="";
       
for (int i=0; i<s.length(); i++){
           
int ch=(int)s.charAt(i);
            String s4
="0000"+Integer.toHexString(ch);
            str
=str+s4.substring(s4.length()-4)+" ";
        }
       
return str;
    }
}

                                                                  

posted on 2009-06-10 21:25 rrong_m 阅读(171) 评论(0)  编辑  收藏

<2024年5月>
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

导航

统计

常用链接

随笔档案

文章分类

文章档案

java编程

搜索

积分与排名

最新评论

阅读排行榜

评论排行榜