Character encoding JSP -displayed wrong in JSP but not in URL: “á » á é » é”

后端 未结 10 1733
忘掉有多难
忘掉有多难 2020-12-03 08:24

I have this Web Application in JSP running on JBoss Application Server. I am using Servlets for friendly urls. I\'m sending search parameters through my JSP\'s and Servlets.

相关标签:
10条回答
  • 2020-12-03 08:56

    I think the problem might be that the browser does not specify the form post to be utf-8. There is a lot to read about form posts and encodings on the web, multiple web frameworks provide character encoding filters to 'fix' this issue, maybe just like your idea for a fix was - see for example http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/web/filter/CharacterEncodingFilter.html

    0 讨论(0)
  • 2020-12-03 08:56

    Do you use RequestDumper? If it is configured in deploy/jboss-web.deployer/server.xml then try to remove it and then test your encoding.

    0 讨论(0)
  • 2020-12-03 09:00

    Try to set URIEncoding in {jboss.server}/deploy/jboss-web.deployer/server.xml.

    Ex:

    <Connector port="8080" address="${jboss.bind.address}"    
         maxThreads="250" maxHttpHeaderSize="8192"
         emptySessionPath="true" protocol="HTTP/1.1"
         enableLookups="false" redirectPort="8443" acceptCount="100"
         connectionTimeout="20000" disableUploadTimeout="true" URIEncoding="UTF-8" />
    
    0 讨论(0)
  • 2020-12-03 09:02

    First off, I have no idea how to solve this, since I don't know much about Java and JSP.

    Having said that: the characters on the right-hand side of your table are the UTF-8 encoding of the left-hand side. That is, somewhere in your code, you're interpreting bytes as Latin-1 (or whatever your default encoding is), where they actually represent UTF-8 encoded characters...

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