Java.io.CharConversionException:Not an ISO 8859-1 character:xxxThis problem may be due to the effect of outputstream output Chinese characters.Response.setcontenttype ("Text/html;charset=utf-8");Response.getoutputstream (). Print ("Chinese text");
Take notes.The problem code is as follows:Response.setcontenttype ("Text/html;charset=utf-8");Servletoutputstream out = Response.getoutputstream ();Then I use the Out object to output Chinese characters to the page: Out.println (" guestbook ");Then
CharSet ExampleUsing UTF8 encoding (internationalized encoding)Use Chinese gb2312 encoding The following coding methods, such as: Chinese GBK, Traditional Chinese Big5, Japanese euc-jp, Korean euc-kr, each language encoding is different, so need to
Java. Io. charconversionexception:Not an ISO 8859-1 character: XXX
This problem may be caused by text output from outputstream.
Response. setcontenttype ("text/html; charset = UTF-8 ");// Response. getoutputstream (). Print ("中文""); // This row has
The initial code is as follows:
Httpservletresponse resp = NULL;
Out = resp. getoutputstream ();
Out. print (" ");
The solution code is as follows:
Resp. setcontenttype ("text/html; charset = UTF-8 ");Resp. getwriter (). Print (" "); //
Previous wordsHTTP messages can host content in any language, as if it could host images, movies, or any type of MEDIA. For http, The entity body is just a container for binary Information. In order to support international content, the server needs
Previous wordsHTTP messages can host content in any language, as if it could host images, movies, or any type of media. For HTTP, the entity body is just a container for binary information. In order to support international content, the server needs
Differences between contenttype, charset, and pageencoding
========================================================= ==================
The contenttype attribute specifies the HTTP content type of the response. If contenttype is not specified, the
The GetBytes () method of the string is to get a string of byte arrays, which is well known. However, it is important to note that this method returns a byte array of the operating system's default encoding format. If you do not take this into
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.