dom4j解析xml需要严格注意编码问题
作者:anotherbug 日期:2007-11-29
当 编码格式为 utf-8 的xml文件中的节点包含纯中文字符时,dom4j读取时如果不指定编码,会引起解析错误。
如
需要指定编码:
[code]
//这里的编码要与xml文件编码格式一致.
Reader reader = new BufferedReader(new InputStreamReader(stream,CjwGlobals.getCharacterEncoding()))...
如
CODE:
<subject>
<![CDATA[您的新密码]]>
</subject>
需要指定编码:
[code]
//这里的编码要与xml文件编码格式一致.
Reader reader = new BufferedReader(new InputStreamReader(stream,CjwGlobals.getCharacterEncoding()))...
contentType 'text/xml; charset=UTF-8' conflicts问题
作者:anotherbug 日期:2007-11-21
Resin升级到3.1.3后,有同事发现原来在Resin 3.0.xx下成功运行的部分jsp文件(输出xml格式文件)编译出错:
[code]
500 Servlet Exception
XXXXX.jsp:1: contentType 'text/xml; charset=UTF-8'
conflicts with previous value of contentType 'text/html; charset=UTF-8'.
Check the .jsp and any included .jsp files for conflicts.
1: <%@ page ...
标签: 编码 问题 ContentType conflicts






