6 Replies Latest reply on Feb 17, 2010 10:53 PM by afibarra.armando.flores.biovetsa.com.mx

    encoding problem

    nongentesimus

      Hello!


      I am using jboss-seam 2.1.2 with richfaces 3.3.0.GA. I tried seamgen, generated an application from jpa entity classes. It seems ok, but there is a problem with search pages. Whenever I enter an accented character (lik é, á, ó, ü..., I am Hungarian, so I definitely need these characters) to a searchfield input I get no search result, and after the action refreshes the page the accented character is transformed into some badly encoded character-like thing. Otherwise accented characters are OK in the application they can be saved, viewed, edited.
      I can circumvent the problem, but it would be great if I could use the simple generated search logic.
      I checked the forum, but did not find too many useful entries. I tried to set the web:character-encoding-filter in components.xml, but it did not help.
      Can anyone reproduce the error, or is it something specific to me?
      Does any of You have ideas for a solution?


      Thanks a lot


      Peter

        • 1. Re: encoding problem
          diegocoronel

          you should use this




          <?xml version="1.0" encoding="ISO-8859-1"?>



          in the first line of your xhtml.

          • 2. Re: encoding problem
            nongentesimus

            Thanks for Your reply.


            Using ISO-8859-1 encoding does not really solve the problem. First of all ISO-8859-1 does not support all Hungarian characters (like ő, ű). If I use ISO-8859-1 and try to input these characters to a field, after the postback I still get back a badly encoded character. What is more if I save my xhtml file with UTF-8 encoding while puting the mentioned tag in the beginning, the whole generated html file will be full with badly encoded characters. I could of course save it as ISO-8859-1, but as I said before this character set just does not support all the Hungarian characters.
            For these reasons I surely would like to use UTF-8 encoding. Using UTF-8 never caused me any trouble with JSF or with Richfaces, so I hoped there might be a solution with Seams too.
            Any idea?


            Thanks


            Péter

            • 3. Re: encoding problem
              gardellajuan

              You must configure your server to encode UTF-8 too.

              • 4. Re: encoding problem
                zogehu

                What database server do you use? You should configure db server UTF-8 too. Hungarian encoding is ISO-8859-2 it would works. You have to use same encoding everywhere. 

                • 5. Re: encoding problem
                  nongentesimus
                  Thanks a lot!

                  Changing the server encoding solved the problem.
                  I use Jboss, so I added URIEncoding="UTF-8" attribute to the connector configurations in server.xml and now everything seems OK. (My database encoding was already UTF-8).

                  Péter
                  • 6. Re: encoding problem
                    afibarra.armando.flores.biovetsa.com.mx

                    Thank you very much for the solution !!!