|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
发信人: lovef1y (阿菜(是菜鸟的菜,不是菜刀的菜!!)), 信区: Java
标 题: Re: 请问如何解决JSP中中文显示出现乱码的问题?非常?
发信站: BBS 水木清华站 (Thu Jun 13 12:13:29 2002)
- <%@ page contentType="text/html;charset=gb2312"%>
- <%!
- static String gb_out_db(String str)
- {
- String dbstr1="";
- try
- {
- String dbstr2="";
- byte [] dbbyte1;
- dbstr2=str;
- dbbyte1=dbstr2.getBytes("iso-8859-1");
- dbstr1=new String(dbbyte1);
- }
- catch(UnsupportedEncodingException uee)
- {
- return str;
- return dbstr1;
- }
- %>
- <%@ page contentType="text/html;charset=gb2312"%>
- <%!
- static String gb_in_db(String str)
- {
- String sqlstmt="";
- try
- {
- byte [] dbbyte1;
- dbbyte1 = str.getBytes();
- sqlstmt = new String(dbbyte1,"iso-8859-1");
- }
- catch(UnsupportedEncodingException uee)
- {
- return str;
- }
- return sqlstmt;
- }
- %>
复制代码
【 在 rxm (我行我素) 的大作中提到: 】
: 我在JSP中显示中文时,特别是要打出表中的内容时,
: 会出现 乱码,不知道该如何解决?请高手帮忙 ,非常感谢!
-- |
|