如何输出一个某种编码的字符串?
public String translate(String str){
String tempStr="";
try{
tempStr=new String(str.getBytes("iso8859-1"),"gbk");
tempStr=tempStr.trim();
}catch(Exception e){
System.err.println(e.getMessage());
}
return tempStr;
}
本文介绍了如何使用Java将ISO-8859-1编码的字符串转换为GBK编码,并进行了字符串修剪的操作。
如何输出一个某种编码的字符串?
public String translate(String str){
String tempStr="";
try{
tempStr=new String(str.getBytes("iso8859-1"),"gbk");
tempStr=tempStr.trim();
}catch(Exception e){
System.err.println(e.getMessage());
}
return tempStr;
}
2283

被折叠的 条评论
为什么被折叠?