Tapestry: character encoding issue

后端 未结 2 769
再見小時候
再見小時候 2021-01-20 11:40

I have a Tapestry application, that retrieves data from a form, writes it to a database and then displays the result. It all works well as long as no special characters (Ä,

相关标签:
2条回答
  • 2021-01-20 11:59

    It was indeed a misconfiguration of my server. The following addition to my web.xml solved it (of course this should also work with a non-Spring filter).

    <filter>
        <filter-name>charsetFilter</filter-name>
        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>UTF-8</param-value>
        </init-param>
    </filter>
    
    <filter-mapping>
        <filter-name>charsetFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    
    0 讨论(0)
  • 2021-01-20 12:07

    I have tried your test string in Tapestry 5.2.6 and 5.3.0-SNAPSHOT and it worked fine. I was able to persist it to the HSQLDB database and pull it back out as expected.

    What version are you using? If you are back in 5.0.x you may need to do something like this: http://wiki.apache.org/tapestry/Tapestry5Utf8Encoding

    0 讨论(0)
提交回复
热议问题