java中文显示问题

hevil 2003-08-26 01:05:50
我从前台提交一个含中文字符的表单,但在后台打印的时候是乱码。
Test.jsp

<%@page contentType='text/html; charset=UTF-8' %>
<%@include file="include.jsp"%>
<%
response.setContentType("text/html;charset=UTF-8");
%>

<form action="test.jsp" name="testform">
<table>
<tr>
<td>
<input type="text" value="" name="texttest">
</td>
<td>
<input type="submit">
</td>
</form>

Testback.jsp
<%@
request.setCharacterEncoding("UTF-8");
%>

<%

String str=new String(request.getParameter("texttest").getBytes("ISO8859_1"),"GBK");

System.out.print(str); ....后台窗口显示乱码

%>
...全文
54 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
hevil 2003-08-26
  • 打赏
  • 举报
回复
不行啊,用out.print可以正常在ie上显示,但System.out.print还是??。
lijunisbug 2003-08-26
  • 打赏
  • 举报
回复
<%@page contentType='text/html; charset=gb2312%>

81,091

社区成员

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

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