JavaWeb java.io.CharConversionException: Not an ISO 8859-1 character: xx
2013-05-13 11:30
666 查看
java.io.CharConversionException:
Not an ISO 8859-1 character: XXX
这个问题可能是因为outputstream输出中文字造成的影响。
response.setContentType("text/html;charset=UTF-8");
//response.getOutputStream().print("中文字"); //这行会出错
response.getWriter().print("中文字"); //换成这个就好了
response.getWriter().close();
原因我个人觉得是因为outputstream是以字节为单位输出字符串的,需要符合那个ISO 8859-1编码;但要输出的字符串是UTF8编码的,所以就有问题。但根源问题,我真没想通。
换成Writer就好了。可能是因为那个inputstream和reader,outputstream和Writer的区别吧。
转载地址:http://www.cnblogs.com/kenkofox/archive/2011/06/09/2076122.html
Not an ISO 8859-1 character: XXX
这个问题可能是因为outputstream输出中文字造成的影响。
response.setContentType("text/html;charset=UTF-8");
//response.getOutputStream().print("中文字"); //这行会出错
response.getWriter().print("中文字"); //换成这个就好了
response.getWriter().close();
原因我个人觉得是因为outputstream是以字节为单位输出字符串的,需要符合那个ISO 8859-1编码;但要输出的字符串是UTF8编码的,所以就有问题。但根源问题,我真没想通。
换成Writer就好了。可能是因为那个inputstream和reader,outputstream和Writer的区别吧。
转载地址:http://www.cnblogs.com/kenkofox/archive/2011/06/09/2076122.html
相关文章推荐
- java.io.CharConversionException: Not an ISO 8859-1 character: xx
- java.io.CharConversionException: Not an ISO 8859-1 character:
- java.io.CharConversionException: Not an ISO 8859-1 character
- java.io.CharConversionException: Not an ISO 8859-1 character:
- Character decoding failed. Parameter skipped.java.io.CharConversionException: isHexDigit.
- Character decoding failed. Parameter skipped.java.io.CharConversionException: isHexDigit.
- Character decoding failed. Parameter skipped.java.io.CharConversionException: isHexDigit.
- 警告: Parameters: Character decoding failed. Parameter skipped. java.io.CharConversionException: isHex
- java.io.CharConversionException: illegal utf8 encoding
- Not an ISO 8859-1 character: 汉
- java.io.FileNotFoundException: OSGi resource[/WEB-INF/views/解决方式
- java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/classes/applicationC
- SqlException with message "Caught java.io.CharConversionException." and ERRORCODE=-4220
- nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/
- Not an ISO 8859-1 character 不存在 ISO 8859-1 编码的字符
- Not an ISO 8859-1 character 不存在 ISO 8859-1 编码的字符
- hadoop 报错Error: java.io.FileNotFoundException: Path is not a file:/xx1/xx2的解决办法
- java.io.CharConversionException: isHexDigit
- Java.io.CharConversionException:EOF
- java.io.CharConversionException: isHexDigit