我的环境是:aix+toncat5.0.28+jdk1.4,我在java代码中组合了一个XML格式的字符串,传到jsp界面时显示乱码啊。jsp中都设置了编码格式( <%@ page contentType="text/html; charset=GBK" %>),这个界面其他汉字都显示正常,只是这个xml的内容显示汉字都是乱码。请大家帮忙啊。急啊。
附上部分代码:
OutputFormat format = new OutputFormat(doc);
format.setEncoding("GBK");
format.setLineWidth(300);
format.setIndenting(true);
format.setIndent(2);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
XMLSerializer ser = new XMLSerializer(bos, format);
ser.serialize(doc);
request.setAttribute("auth_str", new String(bos.toString().getBytes("GBK"),"ISO-8859-1"));
在windows下一直是正常的。在aix上显示的是??????§?è??乱码。
附上部分代码:
OutputFormat format = new OutputFormat(doc);
format.setEncoding("GBK");
format.setLineWidth(300);
format.setIndenting(true);
format.setIndent(2);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
XMLSerializer ser = new XMLSerializer(bos, format);
ser.serialize(doc);
request.setAttribute("auth_str", new String(bos.toString().getBytes("GBK"),"ISO-8859-1"));
在windows下一直是正常的。在aix上显示的是??????§?è??乱码。
LANG=GBK