perhaps this is obvious but noting this anyway for future:
in an ASP.NET WinForms project, it was observed that the code behind serving a request, actually uses the culture specified by the request.
So, the server side code is not necessarily using the culture of the server !
I guess this is obvious, since a web server needs to be able to handle requests from browsers that potentially have different cultures set.
This is especially important when dynamically generating JavaScript code.
for example with culture set to be Russian, then formatting a double will use a comma in place of a decimal point.
In JavaScript, the comma would be unexpected:
//with culture = English,UK:
var myNumber = 5.36; //ok
//with culture = Russia
var myNumber = 5,36; //error !
in an ASP.NET WinForms project, it was observed that the code behind serving a request, actually uses the culture specified by the request.
So, the server side code is not necessarily using the culture of the server !
I guess this is obvious, since a web server needs to be able to handle requests from browsers that potentially have different cultures set.
This is especially important when dynamically generating JavaScript code.
for example with culture set to be Russian, then formatting a double will use a comma in place of a decimal point.
In JavaScript, the comma would be unexpected:
//with culture = English,UK:
var myNumber = 5.36; //ok
//with culture = Russia
var myNumber = 5,36; //error !
Comments
Post a Comment