When i trying to retrieve data in the form of Xml it throws
"Tomcat 6 Servlet getting error: Not an ISO 8859-1 character" exception and on jsp page it display Xml error message. It throws for single quote character. how should i remove this err开发者_如何转开发or.It's perfectly fine for an XML document to use non-ISO-8859 characters, but it should be up front about that. The first line of your XML (The <?xml
one) should state which encoding you're using. The common alternative to ISO-8859-1 would be UTF-8.
Just to make things explicit: You can't change the encoding for a single character. You'll have to change the encoding for the entire XML input.
If you have applied UTF-8 encoding to your xml and still your are getting "Not an ISO 8859-1 character" exception, then convert your string data into byte by using getBytes()
method and also pass "UTF-8" as a parameter to this method like getBytes("UTF-8")
. Then write your byte data on ServletOutputStream
using write()
method. I hope it will help you.
cheers :)
精彩评论