users@javaserverfaces.java.net

Re: Scrambled umlauts in input text field

From: Alexander Hartner <alex_at_j2anywhere.com>
Date: Thu, 1 Nov 2012 08:31:41 +0800

You need to configure your tomcat / JVM to use UTF-8

JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF-8"

as well as the header of the page. This should fix it.

On 01/11/2012, at 7:34 AM, Holger Stenzhorn <holger.stenzhorn_at_gmail.com> wrote:

> Hello all,
>
> Using Mojarra 2.1.14, I have created the following JSF page (see [1]) and managed bean (see [2]).
>
> When I open that page then the umlauts ("äöü") on the command button are displayed correctly.
> Now I enter those same umlauts in the input text field and click on the button (see "before.png").
> The page is redisplayed with the umlauts in the input text field scrambled ("äöü") (see "after.png").
>
> Am I forgetting to do a certain setting here or is this a (possibly known) bug or issue?
> Thanks in advance for your help!
>
> Regards,
> Holger
>
> [1]
> <?xml version="1.0" encoding="UTF-8"?>
> <html xmlns="http://www.w3.org/1999/xhtml"
> xmlns:h="http://java.sun.com/jsf/html">
> <h:body>
> <h:form>
> <h:inputText value="#{bean.value}"/>
> <h:commandButton action="/pages/temp" value="äöü"/>
> </h:form>
> </h:body>
> </html>
>
> [2]
> package some.example;
>
> import javax.faces.bean.ManagedBean;
> import javax.faces.bean.RequestScoped;
>
> @ManagedBean(name="bean")
> @RequestScoped
> public class Bean {
>
> private String value;
>
> public String getValue() {
> return value;
> }
>
> public void setValue(String value) {
> this.value = value;
> }
> }
> <before.png><after.png>