You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Anders Vesterberg <an...@vesdakon.se> on 2003/04/30 10:29:35 UTC

Localization and still wrong chars from input fields

Hello
I am working on an example that is fairly similar to
 editBook in the vlib application. I have a page with a
 list of ToDoItems. You can click on one of them and edit
 in a detail page. In my Engine I have put localization. As
 far as I understand this is all I need to do.

public BorderEngine(){
	super();
	java.util.Locale svLocale = new
 java.util.Locale("sv","SE");
	setLocale(svLocale);
	}

Html is displayed correctly, but when I enter swedish
 characters into input fields they are translated wrong
 when they are put into the attributes in the java class.

'view source' in detail page shows (correctly):
    fika p&#229; maxi
and if I just submit text without changing it, in the list
 I find with 'view source':
    fika p&#195;&#165; maxi
The small a with ring is translated to big A with tilde and
 the yen symbol?

...
    <component id="beskrivning" type="ValidField">
        <static-binding
 name="displayName">Beskrivning</static-binding>
        <binding name="validator"
 expression='beans.stringValidator'/>
        <binding name="value"
 expression='attributes.beskrivning'/>
    </component>
...

I am using Tapestry 2.3 on jdk 1.4.1_01 and Jetty 4.2.9.
Thanks for your help!
/Anders Vesterberg
Vesdakon AB

Re: Localization and still wrong chars from input fields

Posted by Jukka Rahkonen <ju...@itmoon.fi>.
Hi,

Once we had similar problem, which we found out to be
UTF-8/LATIN1 conflict when client browser tries to
detect automatically the used charset. Our solution was
to override getResponseWriter() method on Page base class
in following manner:

  // only way to get latin1 pages ???
  public IMarkupWriter getResponseWriter(OutputStream out) {
    HTMLWriter writer =
      new HTMLWriter("text/html; charset=iso-8859-1",out);
    return writer;
  }

I won't guarrantee that this solves your problem, but
it's fairly easy to try, if you have common base class for
your pages.

BR,
  Jukka Rahkonen   jukka.rahkonen@itmoon.fi





Anders Vesterberg wrote:

>Hello
>I am working on an example that is fairly similar to
> editBook in the vlib application. I have a page with a
> list of ToDoItems. You can click on one of them and edit
> in a detail page. In my Engine I have put localization. As
> far as I understand this is all I need to do.
>
>public BorderEngine(){
>	super();
>	java.util.Locale svLocale = new
> java.util.Locale("sv","SE");
>	setLocale(svLocale);
>	}
>
>Html is displayed correctly, but when I enter swedish
> characters into input fields they are translated wrong
> when they are put into the attributes in the java class.
>
>'view source' in detail page shows (correctly):
>    fika p&#229; maxi
>and if I just submit text without changing it, in the list
> I find with 'view source':
>    fika p&#195;&#165; maxi
>The small a with ring is translated to big A with tilde and
> the yen symbol?
>
>...
>    <component id="beskrivning" type="ValidField">
>        <static-binding
> name="displayName">Beskrivning</static-binding>
>        <binding name="validator"
> expression='beans.stringValidator'/>
>        <binding name="value"
> expression='attributes.beskrivning'/>
>    </component>
>...
>
>I am using Tapestry 2.3 on jdk 1.4.1_01 and Jetty 4.2.9.
>Thanks for your help!
>/Anders Vesterberg
>Vesdakon AB
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>  
>