7 Replies Latest reply on Mar 10, 2010 4:25 PM by victor bernado

    support for spanish characters

    victor bernado Newbie

      Hi,

       

      I'm developping a web application, and the default language is spanish. I use Postgres as DB, and when i restore some value of the DB (the database works in utf-8) richfaces doesn't show them in utf-8.

      For example: in the database i have "muñoz", and in a rich:comboBox is rendenred as "munñoz"

      order example is "bernadó", rendered as "bernadó"

       

      I fill the comboBox with f:selectItems, and the selectItem have the "correct" values (correct is "muñoz")

       

      First of all I think that could hapen for the page encoding, but if I put some spanish character to any component like outputText is correct rendered.

       

      At the head of pages I have <meta http-equiv='Content-Type' content='text/html; charset=utf-8'>

       

      Anyone know the solution???

      Thanks

        • 1. Re: support for spanish characters
          Juan Gonzalez Newbie

          Hi Victor,

           

          I am another spanish richfaces developer. Had some problems some time ago with some characters, but was all facelets related.

           

          Please post some code snippets to see what the problem could be.

          • 2. Re: support for spanish characters
            Ilya Shaikovsky Master
            make sure you using latest version we fixed some issues with encoding in combobox.
            • 3. Re: support for spanish characters
              victor bernado Newbie

              Ei Juan!!!

               

              Could be of facelets because I use them. Code from what you want??

               

              The template look like this:


              <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
              <html xmlns="http://www.w3.org/1999/xhtml"
                    xmlns:h="http://java.sun.com/jsf/html"
                    xmlns:f="http://java.sun.com/jsf/core"
                    xmlns:ui="http://java.sun.com/jsf/facelets"
                    xmlns:ajax="https://ajax4jsf.dev.java.net/ajax"
                    xmlns:rich="http://richfaces.ajax4jsf.org/rich"
                    xmlns:t="http://myfaces.apache.org/tomahawk">
                   
              <head>
                  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
                  <title>   
                      <ui:insert name="title">Default title</ui:insert>
                  </title>
                  <f:view locale="#{logon.locale}"/>
                  <link href="css/template.css" rel="stylesheet" type="text/css" />
              </head>

              ...

               

               

              and the web.xml

               


              <?xml version="1.0" encoding="UTF-8"?>
              <web-app id="WebApp_ID" 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>QuiQueQuanOn</display-name>
              <context-param>
                <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
                <param-value>client</param-value>
              </context-param>
              <context-param>
                <param-name>org.richfaces.SKIN</param-name>
                <param-value>#{logon.skin}</param-value>
              </context-param>
              <context-param>
                <param-name>org.richfaces.CONTROL_SKINNING</param-name>
                <param-value>enable</param-value>
              </context-param>
              <context-param>
                <param-name>contextConfigLocation</param-name>
                <param-value>/WEB-INF/applicationContext.xml</param-value>
              </context-param>
              <context-param>
                <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
                <param-value>.xhtml</param-value>
              </context-param>
              <context-param>
                <param-name>facelets.REFRESH_PERIOD</param-name>
                <param-value>2</param-value>
              </context-param>
              <context-param>
                <param-name>facelets.LIBRARIES</param-name>
                <param-value>/WEB-INF/richfaces.taglib.xml;</param-value>
              </context-param>
              <filter>
                <display-name>RichFaces Filter</display-name>
                <filter-name>richfaces</filter-name>
                <filter-class>org.ajax4jsf.Filter</filter-class>
                <init-param>
                 <param-name>createTempFiles</param-name>
                 <param-value>true</param-value>
                </init-param>
                <init-param>
                 <param-name>maxRequestSize</param-name>
                 <param-value>1000000</param-value>
                </init-param>
              </filter>

                  <filter>
                      <filter-name>Extensions Filter</filter-name>
                      <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
                     
                      <init-param>
                          <description>
                              Set the size limit for uploaded files.
                                  Format: 10  - 10 bytes
                                          10k - 10 KB
                                          10m - 10 MB
                                          1g  - 1 GB
                          </description>
                          <param-name>uploadMaxFileSize</param-name>
                          <param-value>100m</param-value>
                      </init-param>
                      <init-param>
                          <description>
                              Set the threshold size - files below this limit are stored
                              in memory, files above this limit are stored on disk.
                                  Format: 10  - 10 bytes
                                          10k - 10 KB
                                          10m - 10 MB
                                          1g  - 1 GB
                          </description>
                          <param-name>uploadThresholdSize</param-name>
                          <param-value>100k</param-value>
                      </init-param>
                      <init-param>
                          <description>
                              Set the path where the intermediary files will be stored.
                          </description>
                          <param-name>uploadRepositoryPath</param-name>
                          <param-value>/tmp</param-value>
                      </init-param>
                     
                  </filter>
                  <filter-mapping>
                      <filter-name>Extensions Filter</filter-name>
                      <servlet-name>Faces Servlet</servlet-name>
                  </filter-mapping>
                 
              <filter-mapping>
                <filter-name>richfaces</filter-name>
                <servlet-name>Faces Servlet</servlet-name>
                <dispatcher>REQUEST</dispatcher>
                <dispatcher>FORWARD</dispatcher>
                <dispatcher>INCLUDE</dispatcher>
              </filter-mapping>

              <listener>
                <listener-class>org.springframework.web.context.ContextLoaderListener</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>

              <servlet>
                   <servlet-name>Enable User Servlet</servlet-name>
                   <servlet-class>pfc.view.utils.EnableUserServlet</servlet-class>
              </servlet>
              <servlet-mapping>
                   <servlet-name>Enable User Servlet</servlet-name>
                   <url-pattern>/enable/*</url-pattern>
              </servlet-mapping>

              <welcome-file-list>
                <welcome-file>/index.jsp</welcome-file>
              </welcome-file-list>

              <error-page>
                <exception-type>java.lang.Exception</exception-type>
                <location>/exception.xhtml</location>
              </error-page>

              <error-page>
                <error-code>404</error-code>
                <location>/notfound.xhtml</location>
              </error-page>

              <login-config>
                    <auth-method>BASIC</auth-method>
              </login-config>


              </web-app>

               

              the portion page xhtml where I have the problem

               

              <rich:comboBox value="#{search.what}">
                     <f:selectItems value="#{search.whats}"/>
              </rich:comboBox>

               

               

              Do you need anymore???

               

              Ilya, I'm using richfaces 3.3.2-sr1 I think that's the latest version

               

              Thanks to everyone

              • 4. Re: support for spanish characters
                Juan Gonzalez Newbie

                Did you debug the application and checked that correct value is set in your object before rendering that f:selectItem? (for example: "muñoz" is the value just before obtaining the f:selectItems)

                 

                Do you have the correct encoding for you java source code (e.g.: UTF-8 in Eclipse or Netbeans)?

                 

                You mentioned before it 's working ok doing "something", please clarify how...

                • 5. Re: support for spanish characters
                  victor bernado Newbie

                  Hi Juan,

                  Yes, I debug the application and the selectItems have de correct value (muñoz or bernadó etc)

                  The encoding of Eclipse it's the correct, by the other hand the problems appers in developing and in real (exporting war file to tomcat)

                   

                  I try to obtain the title of some page from some bean, and I put at the title something like: "inici ñ" and it renders ok.

                  Other example is that at DB I have some value like "victor bernadó", and if i render it with outputText, is correct rendered.

                  • 7. Re: support for spanish characters
                    victor bernado Newbie

                    Ilya!!!!!

                    thanks!!!!


                    already works ok, I try with the solution of myfaces + filter, but doesn't work. Later I try mojarra and it works ok

                     

                    Thank you very much.

                    Thanks to Juan too.

                     

                    Bye Victor