完整的代码如下注:文章系本人原创:发布于 <script type="text/javascript"> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
12345678910111213141516171819202122232425262728293031323334353637/**
* java字符集转换 Big5 和 Unicode互转
* 转换后的正常字型
*/
import
java.io.*;
public
class
Big5Unicode{
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;
}
}
java字符集转换 Big5 和 Unicode互转
最新推荐文章于 2023-04-12 21:27:24 发布