Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset LC_NUMERIC in pj_init() #49

Closed
proj4-bot opened this issue May 22, 2015 · 3 comments
Closed

Reset LC_NUMERIC in pj_init() #49

proj4-bot opened this issue May 22, 2015 · 3 comments

Comments

@proj4-bot
Copy link

Reported by grisxa on 4 Sep 2009 01:17 UTC
As pj_init() calls pj_datum_set() that in turn calls locale-dependent atof() to convert, say, +towgs84 datum parameters, I suggest to reset LC_NUMERIC to "C" in beginning of pj_init() and get back on exit (see patch).
There is some more atof() in source tree, so maybe another steps should be taken to make proj.4 really locale-independent. See also http://trac.osgeo.org/proj/wiki/FAQ#DoesPROJ.4workindifferentinternationalnumericlocales

Migrated-From: https://trac.osgeo.org/proj/ticket/49

@proj4-bot
Copy link
Author

Comment by grisxa on 4 Sep 2009 13:18 UTC
I should also explain, how this bug happens.

Several multi-lingual applications, like QLandkarteGT, call pj_init() and pj_transform() internally. If projection is specified in form "+init=epsg:2393", file /usr/share/proj/epsg is parsed and datum parameters for 2393 are used. But they are stored with a dot as decimal point, while pj_init() already operates locale-specific decimal point (comma in my case). So atof() rounds float numbers to integers (it stops parsing at first dot met).
That is why I suggest to reset LC_NUMERIC.

As far as I can see, console utils from proj.4 don't have such issue, probably because they are not localized (don't use setlocale()).

@proj4-bot
Copy link
Author

Comment by warmerdam on 24 Sep 2009 02:14 UTC
I concur with your analysis and I have applied just a slight variation on the patch in trunk (a26eedd4 (SVN rev1630)).

@proj4-bot proj4-bot added this to the 4.7.0 milestone May 22, 2015
@proj4-bot
Copy link
Author

Attachment added by grisxa on 4 Sep 2009 01:18 UTC
https://trac.osgeo.org/proj/attachment/ticket/49/proj-4.6.1.diff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant