How to disallow the British pound (£) sign on a site?

Go To StackoverFlow.com

-3

On a site that I am working on, if users change the language settings of their browser to "English (UK)" or an equivalent setting, it changes all of the locations of the dollar sign($) to the sign for the British pound (£). This is incorrect and I need to disallow it. Does anyone know of a solution.

The back-end of the site is supported in Java.

Thank you ahead of time for all suggestions.

2012-04-05 16:31
by canton
If you're working on the site, correct the problem from the backend - Madara Uchiha 2012-04-05 16:33
Yeah, "fixing" it on the frontend just compounds the problems - JayC 2012-04-05 16:34
This is not standard browser behavior. If this is happening then it can only be because of your application's code, either on the server or client side. Figure out where this is happening and disable it at the source, not after the fact - Jordan Running 2012-04-05 16:34
It does not change the value of the dollar amount. That is set from the back-end. The browser seems to just replace the $ sign. For example - instead of displaying $100, it just displays £100 - canton 2012-04-05 16:39
And how are you specifying the currency symbol? A browser may interpret a generic currency symbol as the relevant character for its locale - Andrew Leach 2012-04-05 16:43
@Jordan Your comment should probably be an answer - Jim Garrison 2012-04-05 16:55
@JimGarrison I have taken your advice - Jordan Running 2012-04-05 17:00
@ZackHall something on your back end replaces that $ with a £. The browser doesn't do it - Madara Uchiha 2012-04-05 17:06
@AndrewLeach you are correct! Our application is passing a generic currency symbol link when we needed to be passing the dollar sign link. If you'd like to suggest an answer I will mark yours as the solution! : - canton 2012-04-05 17:08


1

A browser may interpret a generic currency symbol as the relevant character for its locale.

It is possible that your application is interpreting browser GET requests and inferring the locale from them (for example, the user-agent may include "en-GB") and the code is then replacing the generic symbol you specified with the right character for the locale and sending that to the browser.

If you want a dollar and nothing else, specify a dollar sign.

2012-04-05 19:56
by Andrew Leach


7

This is not standard browser behavior. If this is happening then it can only be because of your application's code, either on the server or client side. Figure out where this is happening and disable it at the source, not after the fact.

2012-04-05 17:00
by Jordan Running
@ZackHall: Probably the Java framework you are using tries to do some automagic that you are not aware of - j13r 2012-04-05 17:06


1

I suspect the problem is that money amounts are being stored as plain numbers, and formatted using a NumberFormat obtained by calling getCurrencyInstance for the user's selected locale. If the amounts are always in dollars, then this is the wrong thing to do. Instead, construct a DecimalFormat with a dollar sign in it.

For Pete's sake, don't try and fix this in Javascript.

2012-04-05 17:07
by Tom Anderson
Ads