100分,求解linux下查询出ORACLE的数据中文乱码问题!

skyshine 2005-09-09 02:34:41
代码如下:
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
»Ø¸´£ººÃµÄÃË
?????:好的了


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

50,526

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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