4 Replies Latest reply on May 29, 2009 4:08 PM by luxspes

    UTF-8 encoding problem

    salski22

      I must say I'm confused. I need to use UTF-8 for encoding to get polish characters. To achieve this I did following steps:
      1 I have changed components.xml



      <?xml version="1.0" encoding="UTF-8"?>
      <components xmlns="http://jboss.com/products/seam/components"
                  .........
                  xmlns:web="http://jboss.com/products/seam/web"
                  
                  xsi:schemaLocation=
                      "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd 
                 ..........
                         http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.0.xsd">
      
      
         <web:character-encoding-filter encoding="UTF-8" override-client="true" url-pattern="*.xhtml"/>
      ..........   



      2. I have changed server.xml



      <Connector port="8080" address="${jboss.bind.address}"    
               maxThreads="250" maxHttpHeaderSize="8192"
                useBodyEncodingForURI="true"  URIEncoding="UTF-8"         
                emptySessionPath="true" protocol="HTTP/1.1"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               connectionTimeout="20000" disableUploadTimeout="true" />
      


      by adding


      useBodyEncodingForURI="true"  URIEncoding="UTF-8"



      and I still get error:


      ERROR [STDERR] 2009-05-27 21:34:18 com.sun.facelets.FaceletViewHandler handleRenderException
      SEVERE: Error Rendering View[/app_userList.xhtml]
      com.sun.facelets.FaceletException: Error Parsing /app_userList.xhtml: 
      Error Traced[line: 31] Invalid byte 1 of 1-byte UTF-8 sequence.
           at com.sun.facelets.compiler.SAXCompiler.doCompile(SAXCompiler.java:234)




      and the strange thing is that characters are displayed OK as data retrieved from database, but not as static sting on xhtml page.


      WFT???


      Anybody has any idea??????????

        • 1. Re: UTF-8 encoding problem

          Hi! I always work with UTF-8 (I need it for Spanish characters: á, é, í, ó, ú and ñ and I have never had a problem (I have never had to modify the server.xml either, maybe that is what is causing problems to you?). In fact, the Seam form where I am posting this right now uses UTF-8 encoding (and works fine). Have you tried posting here using Polish characters in the message?

          • 2. Re: UTF-8 encoding problem

            What editor do you use? Some editors save files using UTF8-Y ( also known as signed UTF8 or UTF-8 (signature)) instead of plain UTF-8, in those cases, I have had problems, to fix them, I use an editor like Notepad2 that allow me to change the encoding from UTF-8Y in to UTF-8.

            • 3. Re: UTF-8 encoding problem
              salski22

              Meeeen...


              I am using JBoss Developer Studio and the last thing I was thinking about is to resave xhtml files in UTF-8 encoding. Again simple solution is the best :-)


              It solved problem
              Thanks

              • 4. Re: UTF-8 encoding problem

                Remember, JBoss Developer Studio is Eclipse, and Eclipse, in windows, does not use UTF-8 by default, always check in Windows->Preferences->General->Workspace in the GroupBox Text file encoding that UTF-8 is selected


                If you do not want to worry about that each time you create a new workspace, just alter the eclipse.ini and add: -Dfile.encoding=UTF-8 at the end, that way, Eclipse will work in UTF-8 mode by default