Because i use the automatic POST input with the post method and action i have got a problem with doubles.
When i am working local my doubles work with a " , " and when i publish my project to the my hosting server
de doubles work with ' . " ???????????????
So when i use the Post method and my actions are expacting a double and they get a double whit an other
seperator then the server is using my action gets an error.
Is there a way to set the seperator for doubles when i am programming and testing ????
(because i dont think that my hosting will change there settings)
This is an internationalization issue. One of the things we're working on is identifying where we're using culture-specific string conversion and replacing occurrences with culture-invariant conversion. This should cause the behavior to remain consistent
across servers with different cultures.
For now tho, in your global.asax, in the Application Begin Request event, you can say
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
That should mean all code, including MVC framework, and yours, should all run under the same culture.
Then if you want to be explicit you should use CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator to get the character that is the decimal separator, whether that be a dot or a comma or whatever.
Hope this helps
Marked as answer by toinedeboer on May 02, 2008 07:51 AM
toinedeboer
Member
21 Points
62 Posts
Different seperator for Doubles
May 01, 2008 02:05 PM|LINK
Hello ppl,
Because i use the automatic POST input with the post method and action i have got a problem with doubles.
When i am working local my doubles work with a " , " and when i publish my project to the my hosting server
de doubles work with ' . " ???????????????
So when i use the Post method and my actions are expacting a double and they get a double whit an other
seperator then the server is using my action gets an error.
Is there a way to set the seperator for doubles when i am programming and testing ????
(because i dont think that my hosting will change there settings)
TheDeathArt
Member
123 Points
50 Posts
Re: Different seperator for Doubles
May 01, 2008 04:25 PM|LINK
This is a issue of internalization. Read up about the subject and you'll understand :)
levib
Star
7702 Points
1099 Posts
Microsoft
Re: Different seperator for Doubles
May 01, 2008 06:20 PM|LINK
This is an internationalization issue. One of the things we're working on is identifying where we're using culture-specific string conversion and replacing occurrences with culture-invariant conversion. This should cause the behavior to remain consistent across servers with different cultures.
tgmdbm
Contributor
4392 Points
883 Posts
ASPInsiders
MVP
Re: Different seperator for Doubles
May 02, 2008 01:36 AM|LINK
For now tho, in your global.asax, in the Application Begin Request event, you can say Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
That should mean all code, including MVC framework, and yours, should all run under the same culture.
Then if you want to be explicit you should use CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator to get the character that is the decimal separator, whether that be a dot or a comma or whatever.
Hope this helps
toinedeboer
Member
21 Points
62 Posts
Re: Different seperator for Doubles
May 02, 2008 07:50 AM|LINK
Tnx tgmdbm!
That was a great help, but the NumberDecimalSeparator was readonly :-)
So i used an other aproche with web.config!
<globalization fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8" culture="en-US" uiCulture="en-US"/>
It works great, tnx for your help.