struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Lindholm <greg.lindh...@gmail.com>
Subject Re: applicationresources.properties with utf-8 characters
Date Thu, 02 Jul 2009 13:54:34 GMT
This question comes up often so here are some references:

Take a look at the JavaDoc for Properties [1] and PropertyResourceBundle
[2].  They both state that the properties file must be encoded in ISO 8859-1
with Unicode escapes when the file is loaded from an input stream.

Internally Struts calls ResourceBundle.getBundle() [3] to load the bundle
(properties files) which loads them from an input stream.  So if you use
standard Struts facilities to manage your properties bundles then you must
encode them in ISO 8859-1.

[1] http://java.sun.com/javase/6/docs/api/java/util/Properties.html
[2]
http://java.sun.com/javase/6/docs/api/java/util/PropertyResourceBundle.html
[3]
http://java.sun.com/javase/6/docs/api/java/util/ResourceBundle.html#getBundle(java.lang.String,%20java.util.Locale,%20java.lang.ClassLoader)

On Thu, Jul 2, 2009 at 1:19 AM, Yanto <yantobong@gmail.com> wrote:

> We change applicationresources_zh.properties to utf 8 in our application,
> and the application can show the chinese character properly in the
> application.
> However we are not changing applicationresources.properties to utf8
>
> On Thu, Jul 2, 2009 at 10:49 AM, Wes Wannemacher <wesw@wantii.com> wrote:
>
> > On Wednesday 01 July 2009 21:03:32 Yanto wrote:
> > > Change the file properties, file type to utf8
> > >
> >
> > I am pretty sure that you can only use ISO-8859-1 for properties files. I
> > ran
> > into this once before and the accepted solution is to use the
> native2ascii
> > tool as was previously suggested.
> >
> > -Wes
> >
> > > On Thursday, July 2, 2009, Odelya YomTov <odelya@jpost.com> wrote:
> > > > Hi!
> > > >
> > > > I would like to have in my applicationresources.properties utf-8
> > > > charcters. When I write:
> > > > login.notRecognized = "נא לנסות שנית"
> > > >
> > > > and try to save, I get the message
> > > > Some characters cannot be mapped using ISO-8859-1
> > > >
> > > > What tag can I add to it?
> > > >
> > > > It's a properties file..
> > > >
> > > > Thanks!
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > 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
> >
> > --
> > Wes Wannemacher
> > Author - Struts 2 In Practice
> > Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
> > http://www.manning.com/wannemacher
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message