- /**
- * Big5字与Unicode的互换
- * 转换后的正常字型
- */
- 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;
- }
- }
Big5字与Unicode的互换
最新推荐文章于 2021-02-20 23:00:09 发布