title: Issue with i18n in JSF 2.0 (ukrainian & russian)
body: <p>Goal: I want to use jsf`s i18n</p>
  
  <p>Scenario:</p>
  
  <p>creating resource bundle (utf-8)</p>
  
  <p>file info:</p>
  
  <pre><code> file -I ./messages.properties
  ./messages.properties: text/plain; charset=utf-8
  </code></pre>
  
  <p>using it by</p>
  
  <p>faces-config:</p>
  
  <pre><code>&lt;application&gt;
          &lt;locale-config&gt;
              &lt;default-locale&gt;uk_UA&lt;/default-locale&gt;
              &lt;supported-locale&gt;en_US&lt;/supported-locale&gt;
              &lt;supported-locale&gt;ru_RU&lt;/supported-locale&gt;
          &lt;/locale-config&gt;        
          &lt;resource-bundle&gt;
              &lt;base-name&gt;ua.eset.oasys.hydra.i18n.messages&lt;/base-name&gt;
              &lt;var&gt;i18n&lt;/var&gt;
          &lt;/resource-bundle&gt;
      &lt;/application&gt;
  </code></pre>
  
  <p>in some index.xhtml :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;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:vt="http://java.sun.com/jsf/composite/security"&gt;
  &lt;head&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;ui:composition template="layout/template.xhtml"&gt;
      &lt;ui:define name="top"&gt;
          &lt;h:form&gt;
              &lt;h:panelGrid border="4"&gt;
  
  ...
                  &lt;f:view&gt;                    
                      &lt;h:commandButton value="#{i18n['logout']}" action="#{securityBacking.logout}"/&gt;
                  &lt;/f:view&gt;
              &lt;/h:panelGrid&gt;
          &lt;/h:form&gt;
      &lt;/ui:define&gt;
  
      ...
  
  &lt;/ui:composition&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Problem:
  In result I get wrong encoded text for those buttons.</p>
  
  <p>I was tried to use native2asciiin maven </p>
  
  <p>pom.xml :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;parent&gt;
          &lt;artifactId&gt;oasys&lt;/artifactId&gt;
          &lt;groupId&gt;ua.co.oasys&lt;/groupId&gt;
          &lt;version&gt;1.0&lt;/version&gt;
      &lt;/parent&gt;
  
      &lt;groupId&gt;ua.co.oasys&lt;/groupId&gt;
      &lt;artifactId&gt;hydra&lt;/artifactId&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
      &lt;name&gt;Hydra&lt;/name&gt;
  
  
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;
              UTF-8
          &lt;/project.build.sourceEncoding&gt;
  
          &lt;project.reporting.outputEncoding&gt;
              UTF-8
          &lt;/project.reporting.outputEncoding&gt;
      &lt;/properties&gt;
  
  
      &lt;dependencies&gt;
  
          &lt;!-- SL4J API --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
              &lt;version&gt;1.6.0&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- SLF4J JDK14 Binding  --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;slf4j-jdk14&lt;/artifactId&gt;
              &lt;version&gt;1.6.0&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Injectable Weld-Logger --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.jboss.weld&lt;/groupId&gt;
              &lt;artifactId&gt;weld-logger&lt;/artifactId&gt;
              &lt;version&gt;1.0.0-CR2&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!--&lt;dependency&gt;--&gt;
          &lt;!--&lt;groupId&gt;org.jboss.weld&lt;/groupId&gt;--&gt;
          &lt;!--&lt;artifactId&gt;weld-extensions&lt;/artifactId&gt;--&gt;
          &lt;!--&lt;version&gt;1.0.0.Alpha2&lt;/version&gt;--&gt;
          &lt;!--&lt;/dependency&gt;--&gt;
          &lt;!--&lt;dependency&gt;--&gt;
          &lt;!--&lt;groupId&gt;org.jboss.weld&lt;/groupId&gt;--&gt;
          &lt;!--&lt;artifactId&gt;weld-api&lt;/artifactId&gt;--&gt;
          &lt;!--&lt;version&gt;1.0-CR4&lt;/version&gt;--&gt;
          &lt;!--&lt;/dependency&gt;--&gt;
  
  
          &lt;dependency&gt;
              &lt;groupId&gt;javax.enterprise&lt;/groupId&gt;
              &lt;artifactId&gt;cdi-api&lt;/artifactId&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
              &lt;version&gt;1.0-CR1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.faces&lt;/groupId&gt;
              &lt;artifactId&gt;jsf-api&lt;/artifactId&gt;
              &lt;version&gt;2.0&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax&lt;/groupId&gt;
              &lt;artifactId&gt;javaee-api&lt;/artifactId&gt;
              &lt;version&gt;6.0&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.eclipse.persistence&lt;/groupId&gt;
              &lt;artifactId&gt;javax.persistence&lt;/artifactId&gt;
              &lt;version&gt;2.0.0&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish&lt;/groupId&gt;
              &lt;artifactId&gt;javax.ejb&lt;/artifactId&gt;
              &lt;version&gt;3.0&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish&lt;/groupId&gt;
              &lt;artifactId&gt;javax.servlet&lt;/artifactId&gt;
              &lt;version&gt;3.0-b70&lt;/version&gt;
              &lt;type&gt;jar&lt;/type&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;finalName&gt;hydra&lt;/finalName&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.0.2&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;encoding&gt;utf8&lt;/encoding&gt;
                      &lt;source&gt;1.6&lt;/source&gt;
                      &lt;target&gt;1.6&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
                  &lt;artifactId&gt;native2ascii-maven-plugin&lt;/artifactId&gt;
                  &lt;version&gt;1.0-alpha-1&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;dest&gt;target/classes&lt;/dest&gt;
                      &lt;src&gt;src/main/resources&lt;/src&gt;
                  &lt;/configuration&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;id&gt;native2ascii-utf8&lt;/id&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;native2ascii&lt;/goal&gt;
                          &lt;/goals&gt;
                          &lt;!-- specific configurations --&gt;
                          &lt;configuration&gt;
                              &lt;!--&lt;encoding&gt;UTF8&lt;/encoding&gt;--&gt;
                              &lt;tasks&gt;
                                  &lt;native2ascii encoding="UTF-8"
                                                src="."
                                                dest="src/main/resources" includes="**/*.properties"&gt;
                                      &lt;mapper type="glob" from="*.properties.utf8"
                                              to="*.properties"/&gt;
                                  &lt;/native2ascii&gt;
                              &lt;/tasks&gt;
                          &lt;/configuration&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>I got different symbols, but still wrong.</p>
  
  <p>I made I trick by passing messages with :</p>
  
  <pre><code>String (value.getBytes("ISO-8859-1"),"UTF-8") ;
  </code></pre>
  
  <p>Messages.java :</p>
  
  <pre><code>public class Messages {
      private static final String BUNDLE_NAME = "ua.eset.oasys.hydra.i18n.messages"; 
      private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
  
      private Messages() {
  
      }
  
      public static String getString(String key) {
          try {
              String value = (String) RESOURCE_BUNDLE.getString(key);
              try {
                     return new String (value.getBytes("ISO-8859-1"),"UTF-8") ;
              } catch (UnsupportedEncodingException e) {
                      e.printStackTrace();
                      return null;
              }
          } catch (MissingResourceException e) {
                  return '!' + key + '!';
          }
      }
  }
  </code></pre>
  
  <p>it was successful, I got a valid text, but it is ugly to use in jsf..</p>
  
  <p>info:
  I am using glassfish v3, mac osx (so defaulst encoding latin1 or ISO-8859-1,- no shure.)</p>
  
  <p>Q1: what could be a cause of problem (bad encoding for jsf i18n)? [closed]</p>
  
  <p>Q2: is it possible to do a trick like String (value.getBytes("ISO-8859-1"),"UTF-8") for jsf with the help of maven or by some jsf futures ?</p>
  
  <p><strong>Q3: what is wrong with maven configuration?</strong></p>
  
  <p>Thank you!</p>