package com.edgewww.util;
import java.io.*;
/**
* 字符串转换成unicode码的类
* @author 栾金奎 jsp@shanghai.com
* @date 2001-03-05
*/
public class tounicode {
/**
* 把字符串转换成unicode码
* @param strtext 待转换的字符串
* @param code 转换前字符串的编码,如gbk
* @return 转换后的unicode码字符串
*/
public string tounicode(string strtext,string code) throws unsupportedencodingexception{
char c;
string strret = ;
int intasc;
string strhex;
strtext = new string(strtext.getbytes(8859_1),code);
for ( int i = 0; i c = strtext.charat(i);
intasc = (int)c;
if(intasc>128){
strhex = integer.tohexstring(intasc);
strret = strret + + strhex+;;
}
else{
strret = strret + c;
}
}
return strret ;
}
}
/** 应用举例 */
/** gbk2unicode.jsp */
