SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.
SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.
Successfully reported this slideshow.
Activate your 14 day free trial to unlock unlimited reading.
27.
GET 請求參數編碼處理
• setCharacterEncoding()只針對 POST
– Overrides the name of the character encoding
used in the body of this request.
– 請求用 GET 發送時,沒有定義是否影響 Web 容
器處理編碼的方式
– Tomcat 在 GET 時,setCharacterEncoding()
方法就不會有作用
27
28.
GET 請求參數編碼處理
• 若瀏覽器使用 UTF-8 處理字元,Web 容器
預設使用 ISO-8859-1 作為 URI 編碼
(Tomcat 8.0 之前的版本)
28
29.
GET 請求參數編碼處理
• 若瀏覽器使用 UTF-8 處理字元,相當於作了
這個動作
• Web 容器預設使用 ISO-8859-1 為 URI 編碼
• 用以下編碼轉換來得到正確的「林」字元
29