tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff <jlar...@gmail.com>
Subject Re: Migrating to tomcat 6 gives formatted currency amounts problem
Date Thu, 11 Sep 2008 13:21:23 GMT
On Wed, Sep 10, 2008 at 10:27 AM, Willem Moors <willemslist@gmail.com> wrote:
> I'm transferring my application from a tomcat 5.5.26 server to tomcat
> 6.0.18, and notice that my formatted currency amounts are not being properly
> displayed. Instead of a Pound (GBP) sign I get a question mark within a
> black diamond (the app works fine in 5.5.26).
>
> This can easily be emulated. Add the following lines to the
> HelloWorldExample.java of the servlet examples in Tomcat 5.5.26 and those of
> 6.0.18:
>
>  java.text.NumberFormat currencyFormat=
> java.text.NumberFormat.getCurrencyInstance(Locale.UK);
>  out.print("Formatted currency (GBP) : " + currencyFormat.format(
> 1623540.00 ) );
>
> This will display the following :
>
> In Tomcat 6.0.18: Formatted currency (GBP) : <?>1,623,540.00
> (I've emulated the question-mark within diamond here, I'll send you a
> screenshot if you want)
>
> Tomcat 5.5.26: Formatted currency (GBP) : £1,623,540.00
> (depending on your client you may or not may see the pound sign in front of
> the above amount)
>
> What can be the problem, is there some extra locale configuration that needs
> to be done ?

I experienced similar issues (though not UK Locale) running Tomcat in
Linux/UNIX. For reasons unknown, my Tomcat/Java was not picking up the
default locale of the OS. So I explicitly set them for the JVM by
putting JAVA_OPTS="-Duser.country=US -Duser.language=en" in setenv.sh.
Problem solved. This is admittedly a duct-tape solution. I would
rather know why Java was not using the proper locale and get that
fixed, but time is money.

Examine your Tomcat 5 setup, maybe a similar tweak had been made there..

-- 
Jeff

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message