当前位置: 技术问答>java相关
我使用jbuilder6.0来开发jsp,出现乱码怎么办????急急急!
来源: 互联网 发布时间:2015-04-25
本文导语: 我使用jbuilder6.0来开发jsp,出现乱码怎么办????急急急!那位大虾帮帮忙 | 将问题叙述详细! | //进行编码的转换--------------------------------------------- public String toGb(String uniStr){ ...
我使用jbuilder6.0来开发jsp,出现乱码怎么办????急急急!那位大虾帮帮忙
|
将问题叙述详细!
|
//进行编码的转换---------------------------------------------
public String toGb(String uniStr){
String gbStr = "";
if(uniStr == null){
uniStr = "";
}
try{
byte[] tempByte = uniStr.getBytes("ISO8859_1");
gbStr = new String(tempByte,"GB2312");
}catch(UnsupportedEncodingException uef){
}
return gbStr;
}
public String toUni(String gbStr){
String uniStr = "";
if(gbStr == null){
gbStr = "";
}
try{
byte[] tempByte = gbStr.getBytes("GB2312");
uniStr = new String(tempByte,"ISO8859_1");
}catch(UnsupportedEncodingException uef){
}
return uniStr;
}
public String toGb(String uniStr){
String gbStr = "";
if(uniStr == null){
uniStr = "";
}
try{
byte[] tempByte = uniStr.getBytes("ISO8859_1");
gbStr = new String(tempByte,"GB2312");
}catch(UnsupportedEncodingException uef){
}
return gbStr;
}
public String toUni(String gbStr){
String uniStr = "";
if(gbStr == null){
gbStr = "";
}
try{
byte[] tempByte = gbStr.getBytes("GB2312");
uniStr = new String(tempByte,"ISO8859_1");
}catch(UnsupportedEncodingException uef){
}
return uniStr;
}