Opened 13 years ago

Closed 5 years ago

Last modified 4 years ago

#1385 closed defect (fixed)

reading gcs.csv & pcs.csv is not locale invariant

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 (8)

comment:1 Changed 13 years ago by warmerdam

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 Changed 13 years ago by warmerdam

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 Changed 13 years ago by warmerdam

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 Changed 13 years ago by warmerdam

Description: modified (diff)
Milestone: 1.5.0
Priority: highestnormal
Severity: majornormal

comment:5 Changed 13 years ago by warmerdam

Description: modified (diff)

comment:6 Changed 13 years ago by Markus Neteler

Cc: Markus Neteler added

comment:7 Changed 5 years ago by Even Rouault

Milestone: 1.8.12.0
Resolution: fixed
Status: assignedclosed

Should be addressed by my recent global pass on locale related issues

comment:8 Changed 4 years ago by Even Rouault

Milestone: 2.02.0.0

Milestone renamed

Note: See TracTickets for help on using tickets.