Opened 17 years ago

Last modified 9 years ago

#1385 closed defect

reading gcs.csv & pcs.csv is not locale invariant — at Version 4

Reported by: baumann@… Owned by: warmerdam
Priority: normal Milestone: 2.0.0
Component: OGR_SRS Version: unspecified
Severity: normal Keywords:
Cc: Markus Neteler

Description (last modified by warmerdam)

I have to set the locale to "setlocale(LC_ALL, "C");" before doing an "ogrSpatialRef->importFromEPSG(epsg);". This should be documented somewhere. 

Even better: make the reading of the corresponding CSV files locale invariant by setting the locale to "C" temporarilly during import...

Change History (4)

comment:1 by warmerdam, 17 years ago

Konstantin, 

This is documented in the GDAL FAQ, and affects many aspects of the software.
A few critical points, such as GDALOpen(), do force the C locale temporarily
using the "CPLLocaleC  oLocaleForcer;" guard, but this can be somewhat expensive
so I am hesitant to sprinkle it all through the code. 

I'm going to leave this bug open for a while as a reminder to think further about
this issue. 

comment:2 by warmerdam, 17 years ago

I have modified ogrspatialreference.cpp's OGRPrintDouble() function to 
produce C locale style numbers with fixes up most problems building WKT
strings.

r10720 in trunk. 

Use CPLAtof() in ogr_fromepsg.cpp since all .csv values are C locale. 

r10721 in trunk.

Still more work needs to be done.

comment:3 by warmerdam, 17 years ago

Assorted additional locale improvements in :
ogr_srs_validate.cpp
ogr_srs_proj4.cpp
ogr_spatialreference.cpp

r10725

still outstanding: 
proj_strod() use in gdal/port/cpl_conv.cpp (for DMStoDec, etc).

comment:4 by warmerdam, 17 years ago

Description: modified (diff)
Milestone: 1.5.0
Priority: highestnormal
Severity: majornormal
Note: See TracTickets for help on using tickets.