我们在web应用开发过程中经常遇到输出某种编码的字符,如iso8859-1等,如何输出一个某种编码的字符串?

匿名网友 匿名网友 发布于: 2015-08-30 00:00:00
阅读 107 收藏 0 点赞 0 评论 0

Public String translate (String str) {
String tempStr = “”;
try {
tempStr = new String(str.getBytes(“ISO-8859-1”), “GBK”);
tempStr = tempStr.trim();
}
catch (Exception e) {
System.err.println(e.getMessage());
}
return tempStr;
}

评论列表
文章目录