第一:
在jsp页面加入:
<%@ page contentType="text/html; charset=gb2312" %>
这样就可以解决了在送一个,如何和数据转化因为数据库和app(包括页面),用的编码方式不同。
数据库的中文数据必须经过以下转换
String sApp = new String(rs.getString(1).getBytes("iso-8859-1"),"gb2312")反之
String sDB = new String(sDB.getBytes("gb2312"),"iso-8859-1")
在jsp页面加入:
<%@ page contentType="text/html; charset=gb2312" %>
这样就可以解决了在送一个,如何和数据转化因为数据库和app(包括页面),用的编码方式不同。
数据库的中文数据必须经过以下转换
String sApp = new String(rs.getString(1).getBytes("iso-8859-1"),"gb2312")反之
String sDB = new String(sDB.getBytes("gb2312"),"iso-8859-1")
<%@ page contentType="text/html;charset=GB2312" %>
接收中文的时候
<%
String input1 = new String(request.getParameter("input1").getBytes("ISO8859_1"));
%>显示中文
String s = "中文";
s = String(s.getBytes("ISO8859_1"));