jsp显示数据库中的中文出示乱码

bondhu 2003-10-18 11:36:29
我在我的jsp中设置了
<%@ page contentType="text/html; charset=ISO8859-1" language="java" errorPage="" %>
每次打开页面时,出现乱码,ie的编码属性变为西欧字符。
若手动转换为中文简体,则中文可以正常显示。

若在jsp页面中设置
<%@ page contentType="text/html; charset=gb2312" language="java" errorPage="" %>
每次打开页面时,出现乱码,ie的编码属性为中文简体。
我在JSP中调用了borland的intranetbean
请高手指教。
...全文
26 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
cunguo 2003-10-20
  • 打赏
  • 举报
回复

同意:pleonheart(只睡六小时)
fanjia 2003-10-18
  • 打赏
  • 举报
回复
你可以强制转换一下,用下面语句
str = new String(str.getBytes("ISO8859_1"),"gb2312");
yjawal8071 2003-10-18
  • 打赏
  • 举报
回复
String username=new String(request.getParameter("username").getBytes("8859_1"));
可以解决
叶子哟 2003-10-18
  • 打赏
  • 举报
回复
转换一下,看faq
str = new String(str.getBytes("ISO8859_1"),"gb2312");
pleonheart 2003-10-18
  • 打赏
  • 举报
回复
<%@ page contentType="text/html;charset=GB2312"%>
<%String str = new String(request.getParameter(str).getBytes("iso-8859-"),"GB2312");%>
ok281 2003-10-18
  • 打赏
  • 举报
回复
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

81,092

社区成员

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

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