要設定 Tomcat 處理某個 request 時所使用的 Charset, 要使用 ServletRequest interface 中的方法:
void | setCharacterEncoding(String env) Overrides the name of the character encoding used in the body of this request. |
例如,要處理 UTF8 的 request:
request.setCharacterEncoding("UTF-8");
Tomcat 所預設的 Charset 為: ISO-8859-1.
沒有留言:
張貼留言