Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 861927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T09:03:28+00:00 2026-05-15T09:03:28+00:00

Goal: I want to use jsf`s i18n Scenario: creating resource bundle (utf-8) file info:

  • 0

Goal: I want to use jsf`s i18n

Scenario:

creating resource bundle (utf-8)

file info:

 file -I ./messages.properties
./messages.properties: text/plain; charset=utf-8

using it by

faces-config:

<application>
        <locale-config>
            <default-locale>uk_UA</default-locale>
            <supported-locale>en_US</supported-locale>
            <supported-locale>ru_RU</supported-locale>
        </locale-config>        
        <resource-bundle>
            <base-name>ua.eset.oasys.hydra.i18n.messages</base-name>
            <var>i18n</var>
        </resource-bundle>
    </application>

in some index.xhtml :

<?xml version="1.0" encoding="UTF-8"?>
<!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:vt="http://java.sun.com/jsf/composite/security">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>
<body>

<ui:composition template="layout/template.xhtml">
    <ui:define name="top">
        <h:form>
            <h:panelGrid border="4">

...
                <f:view>                    
                    <h:commandButton value="#{i18n['logout']}" action="#{securityBacking.logout}"/>
                </f:view>
            </h:panelGrid>
        </h:form>
    </ui:define>

    ...

</ui:composition>

</body>
</html>

Problem:
In result I get wrong encoded text for those buttons.

I was tried to use native2asciiin maven

pom.xml :

<?xml version="1.0" encoding="UTF-8"?>
<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">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <artifactId>oasys</artifactId>
        <groupId>ua.co.oasys</groupId>
        <version>1.0</version>
    </parent>

    <groupId>ua.co.oasys</groupId>
    <artifactId>hydra</artifactId>
    <packaging>war</packaging>
    <name>Hydra</name>


    <properties>
        <project.build.sourceEncoding>
            UTF-8
        </project.build.sourceEncoding>

        <project.reporting.outputEncoding>
            UTF-8
        </project.reporting.outputEncoding>
    </properties>


    <dependencies>

        <!-- SL4J API -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.6.0</version>
        </dependency>

        <!-- SLF4J JDK14 Binding  -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-jdk14</artifactId>
            <version>1.6.0</version>
        </dependency>

        <!-- Injectable Weld-Logger -->
        <dependency>
            <groupId>org.jboss.weld</groupId>
            <artifactId>weld-logger</artifactId>
            <version>1.0.0-CR2</version>
        </dependency>

        <!--<dependency>-->
        <!--<groupId>org.jboss.weld</groupId>-->
        <!--<artifactId>weld-extensions</artifactId>-->
        <!--<version>1.0.0.Alpha2</version>-->
        <!--</dependency>-->
        <!--<dependency>-->
        <!--<groupId>org.jboss.weld</groupId>-->
        <!--<artifactId>weld-api</artifactId>-->
        <!--<version>1.0-CR4</version>-->
        <!--</dependency>-->


        <dependency>
            <groupId>javax.enterprise</groupId>
            <artifactId>cdi-api</artifactId>
            <scope>provided</scope>
            <version>1.0-CR1</version>
        </dependency>
        <dependency>
            <groupId>javax.faces</groupId>
            <artifactId>jsf-api</artifactId>
            <version>2.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>6.0</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>javax.persistence</artifactId>
            <version>2.0.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish</groupId>
            <artifactId>javax.ejb</artifactId>
            <version>3.0</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.glassfish</groupId>
            <artifactId>javax.servlet</artifactId>
            <version>3.0-b70</version>
            <type>jar</type>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <finalName>hydra</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.0.2</version>
                <configuration>
                    <encoding>utf8</encoding>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>native2ascii-maven-plugin</artifactId>
                <version>1.0-alpha-1</version>
                <configuration>
                    <dest>target/classes</dest>
                    <src>src/main/resources</src>
                </configuration>
                <executions>
                    <execution>
                        <id>native2ascii-utf8</id>
                        <goals>
                            <goal>native2ascii</goal>
                        </goals>
                        <!-- specific configurations -->
                        <configuration>
                            <!--<encoding>UTF8</encoding>-->
                            <tasks>
                                <native2ascii encoding="UTF-8"
                                              src="."
                                              dest="src/main/resources" includes="**/*.properties">
                                    <mapper type="glob" from="*.properties.utf8"
                                            to="*.properties"/>
                                </native2ascii>
                            </tasks>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

I got different symbols, but still wrong.

I made I trick by passing messages with :

String (value.getBytes("ISO-8859-1"),"UTF-8") ;

Messages.java :

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 + '!';
        }
    }
}

it was successful, I got a valid text, but it is ugly to use in jsf..

info:
I am using glassfish v3, mac osx (so defaulst encoding latin1 or ISO-8859-1,- no shure.)

Q1: what could be a cause of problem (bad encoding for jsf i18n)? [closed]

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 ?

Q3: what is wrong with maven configuration?

Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T09:03:29+00:00Added an answer on May 15, 2026 at 9:03 am

    Q1: the cause is file encoding on file system.

    Q2: I have not find the right way to encode those file with maven, but jetBrains Idea do some trick for me – in Properties it have an Encoding options (File Encodings) – and there is configuration “Default encoding for properties files” – put it to UTF-8 and set ti true check box “Transparent native-to-ascii conversion”
    With this option all work perfect, but it is not a right way as I think, so i will make research for right maven`s native2ascii plugin configuration.

    if some one know what is wrong n my configuration, please answer on Q3.

    Thank you!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

goal : I want to place a text after the submit button using hook_form_alter.
My goal here is to make a button. I want the text to sit
I'm using Flash Builder 4.5. In an .mxml file, if you want to use
Goal: I want to use the function indent-region with the default shortcut C -
I want to use an .exe file inside my c++ program. I reviewed and
Goal: I want to use the Observer Pattern so that when one uiimageview receives
I want to use 1 port for both unencrypted TCP and SSL. The goal
I want to use apachebench (ab) to test file upload performance. I have read
Goal: I want to get the text from the selected element and then create
Note: I do NOT want to use any framework. The goal is just to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.