LINUX JAVA乱码!

skyshine 2005-09-09 02:40:36
代码如下:
String sql = "Select * from t_recieve where Sourceid='" + userid +
"' and state=0 and rownum=1";
// System.out.println(sql);
ResultSet rs1 = stmt.executeQuery(sql);
if (rs1.absolute(1)) {
String msgcontent = rs1.getString("Recontent").trim();
String msgcontent2 = new String(msgcontent.getBytes("GB2312"),
"ISO-8859-1");
String msgcontent3 = new String(msgcontent.getBytes("ISO-8859-1"),
"GB2312");
String msgcontent4 = new String(msgcontent2.getBytes("ISO-8859-1"),
"GB2312");
msgcontent = java.net.URLEncoder.encode(msgcontent);
System.out.println(msgcontent);
System.out.println(msgcontent2);
System.out.println(msgcontent3);
System.out.println(msgcontent4);

显示:

%E5%9B%9E%E5%A4%8D%EF%BC%9A%E5%A5%BD%E7%9A%84%E4%BA%86
»Ø¸´£ººÃµÄÃË
?????:好的了

...全文
112 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
believefym 2005-09-26
  • 打赏
  • 举报
回复
学习
skyshine 2005-09-26
  • 打赏
  • 举报
回复
已解决,方法是,将返回的中文,强制转成URL编码,然后在页面上解URL码!
sunhw2002 2005-09-09
  • 打赏
  • 举报
回复
safa

62,612

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧