With a browser, how do I know which decimal separator does the client use?

Posted by Quassnoi on Stack Overflow See other posts from Stack Overflow or by Quassnoi
Published on 2009-07-02T14:19:45Z Indexed on 2010/05/11 1:24 UTC
Read the original article Hit count: 281

Filed under:
|
|
|

I'm developing a web application.

I need to display some decimal data correctly so that it can be copied and pasted into a certain GUI application that is not under my control.

The GUI application is locale sensitive and it accepts only the correct decimal separator which is set in the system.

I can guess the decimal separator from Accept-Language and the guess will be correct in 95% cases, but sometimes it fails.

Is there any way to do it on server side (preferably, so that I can collect statistics), or on client side?

Update:

The whole point of the task is doing it automatically.

In fact, this webapp is a kind of online interface to a legacy GUI which helps to fill the forms correctly.

The kind of users that use it mostly have no idea on what a decimal separator is.

The Accept-Language solution is implemented and works, but I'd like to improve it.

Update2:

I need to retrive a very specific setting: decimal separator set in Control Panel / Regional and Language Options / Regional Options / Customize.

I deal with four kinds of operating systems:

  1. Russian Windows with a comma as a DS (80%).
  2. English Windows with a period as a DS (15%).
  3. Russian Windows with a period as a DS to make poorly written English applications work (4%).
  4. English Windows with a comma as a DS to make poorly written Russian applications work (1%).

All 100% of clients are in Russia and the legacy application deals with Russian goverment-issued forms, so asking for a country will yield 100% of Russian Federation, and GeoIP will yield 80% of Russian Federation and 20% of other, incorrect answers.

© Stack Overflow or respective owner

Related posts about html

Related posts about web