Proposing to call setlocale( LC_ALL, "C" ) in msSetup()
szekeres.tamas at FREEMAIL.HU
Fri Apr 28 10:57:34 EDT 2006
I think the problem is greater than it seems. That is: portions of the
mapserver C code was created with the assumption that the process
will operate under the default "C" locale and may behave unexpectedly
under the other locales especially when the decimal separator is other
For example the MONO runtime sets the process default locale to the
system default so the problem hardly gets into the action.
The java runtime - as i have noticed - uses the "C" locale by default so
generally this is not a problem. But if you can externally change the the
default local of the process to another (not using dot as the decimal
sepatator) make test will fail because the test.map in the
mapserver/tests directory cannot be parsed correctly.
Mapserver expects dots for the floats regardless of the locale settings.
So the mapserver code is responsible to ensure the correct setting if
I'm not sure if this problem is restricted to the float number conversion,
so replacing atof, strtod etc. to the locale independent
implementations would be great, but i don't think if it is enough.
And we should also take the subsequent libraries into consideration
with the locale dependency stuff.
Umberto Nicoletti <umberto.nicoletti at GMAIL.COM> írta:
> I think the solution is worse than the problem. While it should pose
> no problem for mapserver cgi I can easily imagine it wreaking the
> havoc in Java mapscript and even C# mapscript.
> I am for rewriting the code to be locale sensitive and if possible
> will try to help, but cannot make promises as I am on a really tight
> schedule to fix another localization bug with Java mapscript
> Best regards,
> On 4/27/06, Szekeres Tamás <szekeres.tamas at freemail.hu> wrote:
> > Developers,
> > I had a problem with that mapserver/mapscript is working
> > under the locale context of the host process, but the code
> > is not ready to operate in all locales so far. For example
> > the lexer expects dot as the decimal separator and some of
> > the locales use comma and atof will truncate the numbers to
> > the integer part causing mystical errors.
> > As a quick fix I suggest to call setlocale to the default
> > "C" at the msSetup initialization function.
> > The best solution would rewriting the code to be locale
> > independent if it is expected.
> > Because we can have some side effects with this change I am
> > calling a vote on it.
> > Tamas
> > Digitális képből papírkép már 25 Ft-tól! Ingyenes budapesti
> > http://www.xlab.hu/index.php?zoneid=levelvegi
Nyerj egy lakást! - Az [origo] ingatlan játékán, egy új lakást nyerhetsz a Szent László Házban.
Költözz még idén új lakásba! http://www.origo.hu/adsminisites/ingatlan/jatek/index.html
More information about the mapserver-dev