With several kinds of coding is garbled, request.setcharacterencoding ("UTF-8"); tried several
String newdefrayitem = new String (Request.getparameter ("Newdefrayitem"). GetBytes ("Iso-8859-1"), "GBK"), and changed the encoding several times,
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
Differences between contenttype, charset, and pageencoding
========================================================= ==================
The contenttype attribute specifies the HTTP content type of the response. If contenttype is not specified, the
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 (" "); //
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
Tomcat's default encoding settings and causes of garbled characters
Http://www.linuxso.com/architecture/20099.html
Generation of garbled charactersFor example, the Chinese character "medium" is encoded with a UTF-8 to get a 3 byte value % E4 % B8 %
Java Code Conversion processWe always use a Java class file and the user for the most direct interaction (input, output), these interactive content contains text may contain Chinese. Whether these Java classes interact with the database or interact
Solutions | questions | Chinese 1, the source of Chinese problems
The encoding that the computer's original operating system supports is a single-byte character encoding, so that all handlers in the computer are initially processed in
Js|servlet| Process | Chinese overview
There are local languages in every region of the world. The regional difference leads directly to the difference of language environment. In the process of developing an internationalized program, it is
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.