You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by zkn <zk...@abv.bg> on 2007/05/01 15:28:40 UTC
utf-8 resource files in struts
Hello,
I'm trying to make a simple application that will support multiple
languages. It works fine when I add two latin resource files for
example _en and _fr.
But when I try to add _bg (Bulgarian, cyrillic) file which is saved
as utf-8 the text is not correctly displayed on the site.
I have added <%@ page contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8" language="java" %> to the jsp file but this
doesn't help.
Any ideas?
Ozkan
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: utf-8 resource files in struts
Posted by "Patrick J. Maloney" <pj...@nycap.rr.com>.
I found something nice about JBuilder (version 2006, anyway): If you
paste cyrillic into a .props file and then save it, it will escape it
for you (you don't see it until you reopen the file). Then, you just
need to put UTF-8 in the HTML file.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: utf-8 resource files in struts
Posted by zkn <zk...@abv.bg>.
On 01.05.2007, at 17:21, Martin Gainty wrote:
> I found this helpful on understanding how cyrillic characters are
> represented thru Unicode
> http://en.wikipedia.org/wiki/Cyrillic_alphabet
>
> If you're using windows so You'll need to load Cyrillic Input
> MethodEditor
> http://www.microsoft.com/windows/ie/ie6/downloads/recommended/ime/
> default.mspx
>
We are using OS X. But it's not a problem with fonts. We can display
data in cyrillic. The problem only occurs when reading data from a
resource file.
> As well as Load in cyrillic fonts so you can actually see the
> correct characters for 'codepoints'
> http://babel.uoregon.edu/yamada/fonts/russian.html
>
> Anyone else???
> M--
> This email message and any files transmitted with it contain
> confidential
> information intended only for the person(s) to whom this email
> message is
> addressed. If you have received this email message in error,
> please notify
> the sender immediately by telephone or email and destroy the original
> message without making a copy. Thank you.
>
> ----- Original Message ----- From: "zkn" <zk...@abv.bg>
> To: "Struts Users Mailing List" <us...@struts.apache.org>
> Sent: Tuesday, May 01, 2007 9:28 AM
> Subject: utf-8 resource files in struts
>
>
>> Hello,
> .
>
>> I'm trying to make a simple application that will support multiple
>> languages. It works fine when I add two latin resource files for
>> example _en and _fr.
>> But when I try to add _bg (Bulgarian, cyrillic) file which is
>> saved as utf-8 the text is not correctly displayed on the site.
> .
>
>> I have added <%@ page contentType="text/html; charset=UTF-8"
>> pageEncoding="UTF-8" language="java" %> to the jsp file but this
>> doesn't help.
> .
>
>> Any ideas?
> .
>
>> Ozkan
> .
>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
> .
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: utf-8 resource files in struts
Posted by Martin Gainty <mg...@hotmail.com>.
I found this helpful on understanding how cyrillic characters are
represented thru Unicode
http://en.wikipedia.org/wiki/Cyrillic_alphabet
If you're using windows so You'll need to load Cyrillic Input MethodEditor
http://www.microsoft.com/windows/ie/ie6/downloads/recommended/ime/default.mspx
As well as Load in cyrillic fonts so you can actually see the correct
characters for 'codepoints'
http://babel.uoregon.edu/yamada/fonts/russian.html
Anyone else???
M--
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed. If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy. Thank you.
----- Original Message -----
From: "zkn" <zk...@abv.bg>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Tuesday, May 01, 2007 9:28 AM
Subject: utf-8 resource files in struts
> Hello,
>
> I'm trying to make a simple application that will support multiple
> languages. It works fine when I add two latin resource files for example
> _en and _fr.
> But when I try to add _bg (Bulgarian, cyrillic) file which is saved as
> utf-8 the text is not correctly displayed on the site.
>
> I have added <%@ page contentType="text/html; charset=UTF-8"
> pageEncoding="UTF-8" language="java" %> to the jsp file but this doesn't
> help.
>
> Any ideas?
>
> Ozkan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: utf-8 resource files in struts
Posted by Laurie Harper <la...@holoweb.net>.
zkn wrote:
> On 01.05.2007, at 17:01, Christopher Schultz wrote:
>> It used to be that all .properties files had to be in ISO-8859-1 form,
>> with escape sequences for non-Latin characters.
>> ...
>
> But why do you say "had to be"? Is there other way to do it? Or may be
> just I didn't understand you.
> We tried with struts 1 and struts 2 and it wasn't working.
This requirement is still in place; it comes from the Java API
specification for the Properties file format (referenced from the
PropertyResourceBundle documentation):
http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html#encoding
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: utf-8 resource files in struts
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Ozkan,
zkn wrote:
> Thanks, that worked.
>
> But why do you say "had to be"? Is there other way to do it? Or may be
> just I didn't understand you.
Sorry for the confusion. I started that message before I did a bit of
research and confirmed that it it still the case.
java.util.Properties.load() (and therefore use of
java.util.PropertyResourceBundle through
java.util.ResourceBundle.getBundle()) always require ISO-8859-1 encoding
in properties files.
You can load properties files in other ways, but really
ResourceBundle.getBundle is the best possible way to load a properties file.
> We tried with struts 1 and struts 2 and it wasn't working.
This should be completely independent of Struts. It's just the way that
Java works.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGOAFi9CaO5/Lv0PARAhElAJ9SlDlBZrxFxnD6CKhbQCpyN5QALQCeIoW9
dJVepGnJNDFaljIc4QeCQfQ=
=vprw
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: utf-8 resource files in struts
Posted by zkn <zk...@abv.bg>.
On 01.05.2007, at 17:01, Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Ozkan,
>
> zkn wrote:
>> I'm trying to make a simple application that will support multiple
>> languages. It works fine when I add two latin resource files for
>> example
>> _en and _fr.
>> But when I try to add _bg (Bulgarian, cyrillic) file which is
>> saved as
>> utf-8 the text is not correctly displayed on the site.
>
> It used to be that all .properties files had to be in ISO-8859-1 form,
> with escape sequences for non-Latin characters. If you have a UTF-8
> properties file, transform it for deployment like this:
>
> $ native2ascii -encoding UTF-8 your.properties
> your.properties.iso88591
>
> The file your.properties.iso88591 should now contain the appropriate
> information to be loaded by your app.
Thanks, that worked.
But why do you say "had to be"? Is there other way to do it? Or may
be just I didn't understand you.
We tried with struts 1 and struts 2 and it wasn't working.
> - -chris
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.7 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFGN0gc9CaO5/Lv0PARAoPnAJ9q6aQkh61pHJoHKFIjfQy/xJwJXQCfZR0A
> R5xChci2SLVvZ7ocL37HfrA=
> =VdPP
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: utf-8 resource files in struts
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Ozkan,
zkn wrote:
> I'm trying to make a simple application that will support multiple
> languages. It works fine when I add two latin resource files for example
> _en and _fr.
> But when I try to add _bg (Bulgarian, cyrillic) file which is saved as
> utf-8 the text is not correctly displayed on the site.
It used to be that all .properties files had to be in ISO-8859-1 form,
with escape sequences for non-Latin characters. If you have a UTF-8
properties file, transform it for deployment like this:
$ native2ascii -encoding UTF-8 your.properties your.properties.iso88591
The file your.properties.iso88591 should now contain the appropriate
information to be loaded by your app.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGN0gc9CaO5/Lv0PARAoPnAJ9q6aQkh61pHJoHKFIjfQy/xJwJXQCfZR0A
R5xChci2SLVvZ7ocL37HfrA=
=VdPP
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org