[不明白]用了contentType="text/html; charset=gb2312"就乱码
demo.jsp?message=中文
<%@ page contentType= "text/html; charset=gb2312 " %>
<%
request.setCharacterEncoding( "GB2312 ");
String message = request.getParameter( "message ");
out.print(message);
%>
结果:输出的是问号
====================
去掉
<%@ page contentType= "text/html; charset=gb2312 " %>
后中文就显示正常了
不明白是为什么
------解决方案--------------------gb2312大小写要统一.
------解决方案--------------------你看看你的默认设定,属性也许是utf-8,或者是其他的,也面存成GB2132就会显示不出字
------解决方案--------------------乱码的问题我也出现过,我用的开发工具是wsad,他默认的contentType= "text/html; charset=GB18030 "
pageEncoding= "GB18030 "
是这样的,出现乱码的就是对少数民族名字中间的那个点不任,别的都可以的
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN ">
<HTML>
<HEAD>
<%@ page
language= "java "
contentType= "text/html; charset=GB18030 "
pageEncoding= "GB18030 "
import= "java.sql.*,com.linkdb.*,java.util.ArrayList "
%>
<META http-equiv= "Content-Type " content= "text/html; charset=GB18030 ">
<META name= "GENERATOR " content= "IBM WebSphere Studio ">
<META http-equiv= "Content-Style-Type " content= "text/css ">
<LINK href= "../theme/Master.css " rel= "stylesheet " type= "text/css ">
<link href= "../font.css " rel= "stylesheet " type= "text/css ">
是新建jsp默认的,你在看看吧
------解决方案--------------------看看文件编码格式