You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Mindaugas Genutis <mi...@elinara.ktu.lt> on 2003/08/30 16:29:15 UTC

Problems with UTF-8 encoding

Hello,

I'm having problems displaying Lithuanian characters in my application. My 
web app displays everything in UTF-8. I store localized component strings 
in their *.properties files. I tried two approaches to display Lithuanian 
characters and both of them didn't work:

1. Edited my *_lt.properties files in UTF-8. If I specify in the 
*.application file that I want my templates to be in UTF-8 (<property 
name="org.apache.tapestry.template-encoding" value="utf-8"/>), my output 
displays weird byte strings, get no Lithuanian characters. If I don't 
specify that the templates are in UTF-8, the *.properties are not read at 
all.

2. I tried to have my *.propeties files in ANSI Lithuanian character 
encoding. I still get no Lithuanian characters in the output.

Where should I start, how you people are doing this?

Thanks,

-- 
Kaunas Regional Distance Education Center
Programmer
Phone: +370 674 05232
WWW: http://distance.ktu.lt


Re: Problems with UTF-8 encoding

Posted by Mindbridge <mi...@yahoo.com>.
Hi,

The .properties files are read using the standard ResourceBundle Java class.
That (unfortunately) means that there are special requirements imposed by
the Java implementation that we currently do not work around.

Those requirements are that the .properties files must be run through the
'native2ascii' tool that is part of the Java distribution (please see its
docs for more details). The tool converts the files into plain ASCII by
encoding chars with codes above 127 in the format \u.... The Properties
class as well as ResourceBundle expect the files to be in such format and do
not play nicely with anything non-ASCII.

By adding <property name="org.apache.tapestry.template-encoding"
value="utf-8"/> you ensure that your templates would be read properly in
utf-8. You definitely still need to convert your .properties files using
native2ascii though, since they use a separate (the standard yet less
convenient)  mechanism.

I hope this will resolve your problem
-mb


----- Original Message ----- 
From: "Mindaugas Genutis" <mi...@elinara.ktu.lt>
To: <ta...@jakarta.apache.org>
Sent: Saturday, August 30, 2003 5:29 PM
Subject: Problems with UTF-8 encoding


>
> Hello,
>
> I'm having problems displaying Lithuanian characters in my application. My
> web app displays everything in UTF-8. I store localized component strings
> in their *.properties files. I tried two approaches to display Lithuanian
> characters and both of them didn't work:
>
> 1. Edited my *_lt.properties files in UTF-8. If I specify in the
> *.application file that I want my templates to be in UTF-8 (<property
> name="org.apache.tapestry.template-encoding" value="utf-8"/>), my output
> displays weird byte strings, get no Lithuanian characters. If I don't
> specify that the templates are in UTF-8, the *.properties are not read at
> all.
>
> 2. I tried to have my *.propeties files in ANSI Lithuanian character
> encoding. I still get no Lithuanian characters in the output.
>
> Where should I start, how you people are doing this?
>
> Thanks,
>
> -- 
> Kaunas Regional Distance Education Center
> Programmer
> Phone: +370 674 05232
> WWW: http://distance.ktu.lt
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org