3 Replies Latest reply on May 21, 2013 10:11 AM by mkouba

    Weld2.0.0+tomcat7.0.40+jsf2.0.2 could not support utf8?

        I used jsf2.0.2+tomcat7.0.40,it supports utf8.

        I used jsp+servlet+tomcat7.0.40,it supports utf8.

      but I used Weld2.0.0+tomcat7.0.40+jsf2.0.2,it could not support utf8,why? Does anyone have any suggestions.thanks!

        • 1. Re: Weld2.0.0+tomcat7.0.40+jsf2.0.2 could not support utf8?
          mkouba

          Hi Tony,

           

          could you provide some more information? E.g. what does it mean "utf-8 support"? Some code snippets would be useful as well...

          • 2. Re: Weld2.0.0+tomcat7.0.40+jsf2.0.2 could not support utf8?

            Thanks you help,

            web.xml:

            --------------------------------------------

            <?xml version="1.0" encoding="UTF-8"?>
            <web-app version="2.5"
               xmlns="http://java.sun.com/xml/ns/javaee"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="
                  http://java.sun.com/xml/ns/javaee
               http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
              
               <display-name>Weld Test</display-name>
              
               <context-param>
                  <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
                  <param-value>.xhtml</param-value>
               </context-param>
              
               <listener>
                  <listener-class>org.jboss.weld.environment.servlet.Listener</listener-class>
               </listener>

               <servlet>
                  <servlet-name>Faces Servlet</servlet-name>
                  <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                  <load-on-startup>1</load-on-startup>
               </servlet>

               <servlet-mapping>
                  <servlet-name>Faces Servlet</servlet-name>
                  <url-pattern>*.jsf</url-pattern>
               </servlet-mapping>

               <session-config>
                  <session-timeout>10</session-timeout>
               </session-config>
            </web-app>
            project lib

            lib.JPG

            test program

            progra.JPG

            test:

            test.JPG

            result:

            --------------weld测试
            set usernameweld???è??
            ----------------这个打印出来的字符-------------
            weld???è??
            11111

            please give me suggestions,Thanks.

             

             

             

             

             

             

             

             

             

            • 3. Re: Weld2.0.0+tomcat7.0.40+jsf2.0.2 could not support utf8?
              mkouba

              Tony,

               

              your problem seems to be weld-unrelated and the code does not make sense, in other words the output is expected - if you call "some accented chars".getBytes("ISO-8859-1") any unknown character is replaced with question mark...