Java--Commit garbled summary

Source: Internet
Author: User

* submitted garbled
* GET: (parameter in the address bar to submit, the address bar also has its own code, the default is the foreigner's iso-8859-1)
* * Modify the Tomcat default character set. (The scope of the impact is too large, it may affect other items, not recommended)
* * Urlencoder and Urldecoder class (on the line 2 back)
* * New String (s.getbytes ("iso-8859-1"), "UTF-8");
* * POST:
* * The buffer of the request object is iso-8859-1 by default.
* * request.setcharacterencoding ("UTF-8"); (sets the decoding mode of the buffer)
* * Output to page Chinese:
* * Getoutputstream ();
* * Response.getoutputstream (). Write ("Meimei". GetBytes ());
* * Not necessarily:
* * GetBytes (); default encoding GBK.
* GetBytes ("UTF-8");
* * Open with GBK when the browser is open.
* Response.setheader ("Content-type", "text/html;charset=utf-8");
* * Getwriter (); ---character stream buffer
* * Response.getwriter (). println ("Meimei");
* * will certainly.
* * Response buffers are iso-8859-1 by default.
* 1. Set the encoding of the response buffer
* Response.setcharacterencoding ("UTF-8");
* * 2. How to encode the browser's opening
* Response.setheader ("Content-type", "text/html;charset=utf-8");
* * * * * * RESPONSE.SETCONTENTTYPE ("Text/html;charset=utf-8");

Java--Commit garbled summary

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.