aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes german comma + javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "german comma + javascript" Watch "german comma + javascript" New topic
Author

german comma + javascript

shankar vembu
Ranch Hand

Joined: May 10, 2001
Posts: 309
In my javascript code, I make some mathematical calculations and then set the result value to a form variable, and i access this form variable in my servlet to get the value.
Now my question is how will my javascript functions treat the decimal in numbers, comma or period?? My appl. was running fine with english way of numbers where I dont handle anywhere in my client/server code for this period/comma issue. But all of a sudden, my server side code threw a NumberFormatException when accesing the form variable. It was taking comma instead of period in decimal numbers. Why is this strange behavior? And BTW all my browser and locale settings are german, inspite of this my appl. was running OK with enlglish way of representing numbers....
AM i missing something here??
shankar.
p.s. i am unable to reproduce the exception all the time.....
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
To the best of my knowledge, Javascript is only going to treat the decimal point and not the comma.
You can easily change the decimal point to a comma with no problem with reg exp and you can use that to your application if necessary.
Eric
shankar vembu
Ranch Hand

Joined: May 10, 2001
Posts: 309
Originally posted by Eric Pascarello:
To the best of my knowledge, Javascript is only going to treat the decimal point and not the comma.

even if all my locale settings including my browser is in german???In that case how do German applications work. Do they have to replace period with commma all over ??
[ December 16, 2003: Message edited by: shankar vembu ]
[ December 16, 2003: Message edited by: shankar vembu ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: german comma + javascript