6 Replies Latest reply on Jul 30, 2007 6:27 AM by przemyslawo

    general question on encoding

    hasc

      Hello,

      i' ve got a general question on encoding.

      I encoded my messages_de.properties file in UTF-8 and if i add charakters like (Ä,ä,Ü,ü) they are displayed wrong. If i change back to ISO-8859-1 it works fine. All xhtml files begin with the line

      <?xml version="1.0" encoding="UTF-8"?>

      and are encoded in UTF-8.

      I expected it to work but maybe i have a misunderstanding here. can someone expain me the thing or point me to a reference where it is explained?

      regards,
      hasc




        • 1. Re: general question on encoding
          przemyslawo

          I have the same problem with polish characters (????ó???) when I am using them in messages_pl.properties.
          My .xhtml files are set to UTF-8 encoding, and polish characters are displayed well.
          Only text from messages in some place is converted to: &Auml sequence of chars (looks like: Ä :) )


          • 2. Re: general question on encoding
            wise_guybg

            I don't think that you should have foreign characters in the xhtml.

            As of the properties files... they should be in ISO-8859-1 that's the standard. Any characters >128 (I think) should be encoded like this \uXXXX (I think). All java IDE's contain a plugin that helps you write your properties file in the language you want and have it converted when you deploy.

            • 3. Re: general question on encoding
              przemyslawo

              Thanks for quick answer.

              Do you know how to make such a mapping from non-english characters to \uXXXX in painless way in eclipse?

              PS.
              It's not so obvious that standard for .properties is ISO-8859-1, when everywhere in java world UTF-8 is a standard.
              Especially using ISO-8859-1 in files that are used for internationalization is a little bit strange.
              I think that this should be explained in reference documentation Chapter 14. Internationalization and themes.

              • 4. Re: general question on encoding
                wise_guybg

                You're right that it's not obvious. And given the fact that every IDE needs a plugin for properties files, I think that this is a strange standard. This comes from Java, not Seam.

                From another forum:

                You can't. Java property files are always encoded in ISO-8859-1. In
                order to use other characters you need to escape them properly. There
                is an encoder/decoder for it and/or eclipse plugin.


                http://www.google.bg/search?q=properties+eclipse

                Sorry but I don't use Eclipse and I have not found a good way to handle properties files when I was using it.

                • 5. Re: general question on encoding
                  wise_guybg

                  You can use ant build with this:

                  Like all java properties files, the file is encoded in ISO-8859-1; if you need to represent other characters, you will need to use escape sequences. The standard Java programs "native2ascii" or "ascii2native" is the best way to write these secape sequences. Search http://java.sun.com for more information on using these tools.


                  • 6. Re: general question on encoding
                    przemyslawo