Unable to change charset from ISO-8859-1 to UTF-8 in glassfish 3.1

前端 未结 4 1354
北恋
北恋 2020-12-01 13:12

I am having problems to change the charset in my web application response from ISO-8859-1 (default) to UTF-8. I already added the VM option -Dfile.encoding=UTF-8

4条回答
  •  余生分开走
    2020-12-01 13:59

    The -Dfile.encoding is a Oracle JVM specific setting as to how to read Java source files. This doesn't have any influence on the charset as specified in the Content-Type header of the HTTP response.

    You need to add the following to your web.xml in order to send the response of all JSPs as UTF-8 and to let it set the appropriate charset in the response header.

    
        
            *.jsp
            UTF-8
        
    
    

    See also:

    • Unicode - How to get the characters right?

提交回复
热议问题