POST parameters using wrong encoding in JSF 1.2

后端 未结 3 1607
抹茶落季
抹茶落季 2021-01-13 16:46

I\'m having a problem with charset encoding in my web application (JSF 1.2, Spring and Tomcat 7), and I\'ve ran out of ideas of what to test to see where it is going wrong.<

3条回答
  •  迷失自我
    2021-01-13 17:33

    BalusC's answer helped me to better understand the problem, but what solved it for me was putting the Character Encoding Filter as the FIRST filter in the chain (putting it above all the others in the web.xml file).

    This is the filter I used:

    
    
        characterEncodingFilter
        org.springframework.web.filter.CharacterEncodingFilter
        
            encoding
            utf-8
        
        
            forceEncoding
            true
        
    
    
        characterEncodingFilter
        /*
    
    

    Apparently, the data was read before the parameter was set by the filter. I got the hint from this page: http://tech.top21.de/techblog/20100421-solving-problems-with-request-parameter-encoding.html

    Thanks everybody!

提交回复
热议问题