How to handle UTF-8 characters in struts ApplicationResources.properties

ningjun.wang_at_lexisnexis.com
Date: 01/10/05


Date: 10 Jan 2005 11:14:01 -0800

I used WSAD5 and struts to develop a Japaness site using UTF-8. I
defined error message in strut's ApplicationResources.properties file.
If the error message contains Japaness characters (UTF-8 encoding), it
will not be displayed correctly in the browser.

For example ApplicationResources.properties contains the following:

error.login.invalidCredential=吉川英一郎: Your userName/password
is invalid. Please try again.

I raise this error in my action class as follow:

errors.add("login", new ActionError("error.login.invalidCredential"));

In the JSP I displayed the error using
<html:errors />

When I run the application, the JSP display the following message:

吉川英一郎: Your userName/password is invalid.
Please try again.

Note that the English characters are displayed correctly but not the
Japaness characters.

What is wrong?

Ningjun



Relevant Pages

  • Re: How to handle UTF-8 characters in struts ApplicationResources.properties
    ... > defined error message in strut's ApplicationResources.properties file. ... > If the error message contains Japaness characters (UTF-8 encoding), ... > When I run the application, the JSP display the following message: ...
    (comp.lang.java.programmer)
  • Re: PDF file opens in Acrobat but not Preview
    ... When I tried to open the file, I got a window from TextEdit saying ... Next time when you get an error message and want us to help, ... II did not really ask for help - I used 'less', and noticed the TextEdit ... it would mean that the file contains UTF-8 errors. ...
    (comp.sys.mac.system)
  • Re: OE^ Links dont work
    ... URL's as UTF-8. ... I get an error message sometimes which says ... I was not installing any other programs or downloading any ... ending quote mark and the Fwd slash. ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: Publisher wont publish to the web
    ... I tried your suggestion from the FAQs of changing the language to Unicode ... UTF-8. ... That removed the error message but the file did not load correctly ...
    (microsoft.public.publisher.webdesign)