Response to page in response to Chinese garbled problem
Byte stream
* may be garbled, with Chinese converted to byte array, browser open default character encoding about
* Workaround: Use the same character set when you turn Chinese into byte arrays and the browser opens by default
Response.setheader ("Content-type", "Text/html;charset=utf-8"); Response.getoutputstream (). Write ("Zhang San". GetBytes ("Utf-8"));
Character Stream
* must be garbled, because The default encoding for the response character buffer is iso-8859-1
* Workaround: Set response to get the encoding of the character stream buffer and set the character set that the browser uses when it is opened by default
// Set Browser default open character set response.setheader ("Content-type", "Text/html;charset=utf-8"); // sets the character stream buffer encoding response.setcharacterencoding ("Utf-8"); Response.getwriter (). println ("Zhang San") ;
* use character flow to page response there is a simplified notation
Response.setcontenttype ("Text/html;charset=utf-8"); Response.getwriter (). println ("Zhang San");
Javaweb's response response to Chinese garbled problem