当前位置: 技术问答>java相关
jsp里面Session里面能写进中文吗?怎么用我用ISO8859-1转换了还是一堆??????
来源: 互联网 发布时间:2015-01-01
本文导语: String PackageName = "哈哈哈哈"; String temp = new String(PackageName.getBytes("ISO8859-1")); session.setAttribute("pkgname", temp); | String gbstr="中文"; String tmpstr=new String(gbstr.getBytes("GBK"),"ISO8859_1") session.setAttribut...
String PackageName = "哈哈哈哈";
String temp = new String(PackageName.getBytes("ISO8859-1"));
session.setAttribute("pkgname", temp);
String temp = new String(PackageName.getBytes("ISO8859-1"));
session.setAttribute("pkgname", temp);
|
String gbstr="中文";
String tmpstr=new String(gbstr.getBytes("GBK"),"ISO8859_1")
session.setAttribute("pkgname",gbstr);
你试一下
String tmpstr=new String(gbstr.getBytes("GBK"),"ISO8859_1")
session.setAttribute("pkgname",gbstr);
你试一下
|
内容没有错,是把内容显示出来的问题吧。在哪里看到的一堆???????
|
String PackageName = "哈哈哈哈";
String temp1 = new String(PackageName.getBytes("gb2312"),"ISO8859-1");
session.setAttribute("pkgname", temp);
String temp2 = new String((String)session.getAttribute("pkgname").getBytes("ISO8859-1"),"gb2312");
String temp1 = new String(PackageName.getBytes("gb2312"),"ISO8859-1");
session.setAttribute("pkgname", temp);
String temp2 = new String((String)session.getAttribute("pkgname").getBytes("ISO8859-1"),"gb2312");
|
String PackageName = "哈哈哈哈";
String temp = new String(PackageName.getBytes("ISO8859-1"),"ISO8859-1");
session.setAttribute("pkgname", temp);
试试这个行不行,不知你机器的缺省编码是什么,最好在构建字符串是也加上编码方式
String temp = new String(PackageName.getBytes("ISO8859-1"),"ISO8859-1");
session.setAttribute("pkgname", temp);
试试这个行不行,不知你机器的缺省编码是什么,最好在构建字符串是也加上编码方式
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。