页面开始使用<%@ page contentType="text/html; charset=GB2312" %>只对当前页面的中文内码有用。接收参数时还是要用字符转换的String inputinfo = new String(request.getParameter("nodeinfo").getBytes("8859_1"),"GB2312");
解决方案 »
- 求解一个简单的数据库写入
- 这个问题怎么解答?求详细理由及答案
- javax.naming.NameNotFoundException: name shopping is not bound in this Context
- 如何解读jsp界面调试时出现的错误,怎么解决问题!
- 关于xml节点名称的问题!!1
- 将list里的值显示出来
- 上传附件 保存在 webRoot 下 从新编译后 附件就都没了
- 怎么设置DOrado5控件字体大小
- bean中,编译好的.CLASS文件放哪里才能找的到,
- 求一条SQL查询语句
- tomcat+win98的安装
- 书上都讲jsp开发的网站很快很快,但是从实践效果和外面的用jsp开发的网站的速度来,好象不是一回事??
public String toChinese(String ss) {
if(ss!=null){
//处理中文问题
try{
String temp_p=ss;
byte[] temp_t=temp_p.getBytes("ISO8859-1");
ss=new String(temp_t);
}catch(Exception e){
System.err.println("toChinese exception:"+e.getMessage());
System.err.println("The String is:"+ss);
}
}
return ss;
}
request.setCharacterEncoding("GB2312");
需要将中文转化为西文码
1、request.setCharacterEncoding("GB2312");具体该怎样加,我直接加到JSP页面的<% %>中,提示错误。
2、String aaa= new String(request.getParameter("nodeinfo").getBytes("8859_1"),"GB2312");中的nodeinfo是指任意的字符吗?
3、是否出现过的中文都需要进行转换?
request.setCharacterEncoding("GB2312");
response.setContentType("text/html; charset=GB2312");2、是你的域