You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Alexey Hanin <ga...@gmail.com> on 2007/05/25 15:45:52 UTC

T5: Scrambled unicode localized message

Hi!

I am using Tapestry 5.0.4 and trying to display cyrillic unicode characters
within a simple template (Login.html):

<t:form t:id="form"
 xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
 <t:label t:for="username"/>:
 <t:textField t:id="username" t:value="prop:username"/>
 <t:submit t:value="message:submit-label"/>
</t:form>

Here are contents of my Login_ru.properties:

username-label=Юзернэйм
submit-label=Сабмит

In result i have scrambled cyrillic text:

<label for="username" id="username:label">Ð(r)зернэйм</label>:
<input id="username" name="username" type="text" value=""><img
alt="[Error]" class="t-error-icon t-invisible" id="username:icon"
src="/app/assets/tapestry/field-error-marker.png">
<input id="submit" name="submit" type="submit"
value="Сабмит"><img alt="[Error]" class="t-error-icon
t-invisible" id="submit:icon"
src="/app/assets/tapestry/field-error-marker.png"></form>


I've injected 'Messages' in Login component class and tried to resolve
localized value from ther but result was the same.
My properties file is in UTF-8, Also I have performed steps from the "How to
use UTF-8 encoding in T5" (http://wiki.apache.org/tapestry/Utf8EncodingInT5
).
Browser determines encoding correctly.
I've set encoding to UTF-8 in every place and still no success.

Please, tell me am I am missing something?

Regards,

Alexey.

Re: T5: Scrambled unicode localized message

Posted by Howard Lewis Ship <hl...@gmail.com>.
That hasn't been implemented for T5 yet, but the underpinnings (meta-data
support for components, to determine the encoding) is present.  XML
properties files is news to me however and worth looking into!

On 5/25/07, Jesse Kuhnert <jk...@gmail.com> wrote:
>
> I think Tapestry uses a LocalizedProperties class to load properties files
> so you don't need to use native2ascii doesn't it? It does in T4 at
> least.  I
> even saw that GWT is using the same class with a special thanks to
> Tapestry
> for providing it. :)
>
> On 5/25/07, James, Nick CWT-MSP <NJ...@carlsonwagonlit.com> wrote:
> >
> > Just a suggestion, without having tested it...
> >
> > The Java implementation of Property is not able to read UTF-8 encoded
> > characters in the .properties file because it uses Latin1 as its (only)
> > encoding. See
> > http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html and
> its
> > recommendation to use the native2ascii utility to convert the UTF8
> > characters.
> >
> > BTW In Java 5, they implemented property files using XML, which use UTF8
> > as their default encoding. Maybe an xml property file would work for you
> > (don't forget the encoding in the header :) )
> >
> > Perhaps you could try running native2ascii on your properties, or
> convert
> > them to xml?
> >
> > HTH,
> >
> > Nick.
> >
> >
> > Nick James
> > Systems Architect
> > Direct Line: +1 763 212 0579
> >
> >
> > -----Original Message-----
> > From: Alexey Hanin [mailto:gagarin61@gmail.com]
> > Sent: Friday, May 25, 2007 8:46 AM
> > To: users@tapestry.apache.org
> > Subject: T5: Scrambled unicode localized message
> >
> > Hi!
> >
> > I am using Tapestry 5.0.4 and trying to display cyrillic unicode
> > characters
> > within a simple template (Login.html):
> >
> > <t:form t:id="form"
> > xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> > <t:label t:for="username"/>:
> > <t:textField t:id="username" t:value="prop:username"/>
> > <t:submit t:value="message:submit-label"/>
> > </t:form>
> >
> > Here are contents of my Login_ru.properties:
> >
> > username-label=Юзернэйм
> > submit-label=Сабмит
> >
> > In result i have scrambled cyrillic text:
> >
> > <label for="username" id="username:label">Ð(r)зернэйм</label>:
> > <input id="username" name="username" type="text" value=""><img
> > alt="[Error]" class="t-error-icon t-invisible" id="username:icon"
> > src="/app/assets/tapestry/field-error-marker.png">
> > <input id="submit" name="submit" type="submit"
> > value="Сабмит"><img alt="[Error]" class="t-error-icon
> > t-invisible" id="submit:icon"
> > src="/app/assets/tapestry/field-error-marker.png"></form>
> >
> >
> > I've injected 'Messages' in Login component class and tried to resolve
> > localized value from ther but result was the same.
> > My properties file is in UTF-8, Also I have performed steps from the
> "How
> > to
> > use UTF-8 encoding in T5" (
> > http://wiki.apache.org/tapestry/Utf8EncodingInT5
> > ).
> > Browser determines encoding correctly.
> > I've set encoding to UTF-8 in every place and still no success.
> >
> > Please, tell me am I am missing something?
> >
> > Regards,
> >
> > Alexey.
> >
>
>
>
> --
> Jesse Kuhnert
> Tapestry/Dojo team member/developer
>
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
>



-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

Re: T5: Scrambled unicode localized message

Posted by Jesse Kuhnert <jk...@gmail.com>.
I think Tapestry uses a LocalizedProperties class to load properties files
so you don't need to use native2ascii doesn't it? It does in T4 at least.  I
even saw that GWT is using the same class with a special thanks to Tapestry
for providing it. :)

On 5/25/07, James, Nick CWT-MSP <NJ...@carlsonwagonlit.com> wrote:
>
> Just a suggestion, without having tested it...
>
> The Java implementation of Property is not able to read UTF-8 encoded
> characters in the .properties file because it uses Latin1 as its (only)
> encoding. See
> http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html and its
> recommendation to use the native2ascii utility to convert the UTF8
> characters.
>
> BTW In Java 5, they implemented property files using XML, which use UTF8
> as their default encoding. Maybe an xml property file would work for you
> (don't forget the encoding in the header :) )
>
> Perhaps you could try running native2ascii on your properties, or convert
> them to xml?
>
> HTH,
>
> Nick.
>
>
> Nick James
> Systems Architect
> Direct Line: +1 763 212 0579
>
>
> -----Original Message-----
> From: Alexey Hanin [mailto:gagarin61@gmail.com]
> Sent: Friday, May 25, 2007 8:46 AM
> To: users@tapestry.apache.org
> Subject: T5: Scrambled unicode localized message
>
> Hi!
>
> I am using Tapestry 5.0.4 and trying to display cyrillic unicode
> characters
> within a simple template (Login.html):
>
> <t:form t:id="form"
> xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> <t:label t:for="username"/>:
> <t:textField t:id="username" t:value="prop:username"/>
> <t:submit t:value="message:submit-label"/>
> </t:form>
>
> Here are contents of my Login_ru.properties:
>
> username-label=Юзернэйм
> submit-label=Сабмит
>
> In result i have scrambled cyrillic text:
>
> <label for="username" id="username:label">Ð(r)зернэйм</label>:
> <input id="username" name="username" type="text" value=""><img
> alt="[Error]" class="t-error-icon t-invisible" id="username:icon"
> src="/app/assets/tapestry/field-error-marker.png">
> <input id="submit" name="submit" type="submit"
> value="Сабмит"><img alt="[Error]" class="t-error-icon
> t-invisible" id="submit:icon"
> src="/app/assets/tapestry/field-error-marker.png"></form>
>
>
> I've injected 'Messages' in Login component class and tried to resolve
> localized value from ther but result was the same.
> My properties file is in UTF-8, Also I have performed steps from the "How
> to
> use UTF-8 encoding in T5" (
> http://wiki.apache.org/tapestry/Utf8EncodingInT5
> ).
> Browser determines encoding correctly.
> I've set encoding to UTF-8 in every place and still no success.
>
> Please, tell me am I am missing something?
>
> Regards,
>
> Alexey.
>



-- 
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

RE: T5: Scrambled unicode localized message

Posted by "James, Nick CWT-MSP" <NJ...@carlsonwagonlit.com>.
Just a suggestion, without having tested it...

The Java implementation of Property is not able to read UTF-8 encoded characters in the .properties file because it uses Latin1 as its (only) encoding. See http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html and its recommendation to use the native2ascii utility to convert the UTF8 characters.

BTW In Java 5, they implemented property files using XML, which use UTF8 as their default encoding. Maybe an xml property file would work for you (don't forget the encoding in the header :) )

Perhaps you could try running native2ascii on your properties, or convert them to xml?

HTH,

Nick.


Nick James 
Systems Architect 
Direct Line: +1 763 212 0579 
  

-----Original Message-----
From: Alexey Hanin [mailto:gagarin61@gmail.com] 
Sent: Friday, May 25, 2007 8:46 AM
To: users@tapestry.apache.org
Subject: T5: Scrambled unicode localized message

Hi!

I am using Tapestry 5.0.4 and trying to display cyrillic unicode characters
within a simple template (Login.html):

<t:form t:id="form"
 xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
 <t:label t:for="username"/>:
 <t:textField t:id="username" t:value="prop:username"/>
 <t:submit t:value="message:submit-label"/>
</t:form>

Here are contents of my Login_ru.properties:

username-label=Юзернэйм
submit-label=Сабмит

In result i have scrambled cyrillic text:

<label for="username" id="username:label">Ð(r)зернэйм</label>:
<input id="username" name="username" type="text" value=""><img
alt="[Error]" class="t-error-icon t-invisible" id="username:icon"
src="/app/assets/tapestry/field-error-marker.png">
<input id="submit" name="submit" type="submit"
value="Сабмит"><img alt="[Error]" class="t-error-icon
t-invisible" id="submit:icon"
src="/app/assets/tapestry/field-error-marker.png"></form>


I've injected 'Messages' in Login component class and tried to resolve
localized value from ther but result was the same.
My properties file is in UTF-8, Also I have performed steps from the "How to
use UTF-8 encoding in T5" (http://wiki.apache.org/tapestry/Utf8EncodingInT5
).
Browser determines encoding correctly.
I've set encoding to UTF-8 in every place and still no success.

Please, tell me am I am missing something?

Regards,

Alexey.