Opened 13 years ago

Closed 13 years ago

#1414 closed defect (fixed)

world files and locale

Reported by: warmerdam Owned by: warmerdam
Priority: high Milestone: 1.4.1
Component: GDAL_Raster Version: unspecified
Severity: normal Keywords:
Cc: Markus Neteler

Description (last modified by warmerdam)

When operating in the C locale, GDAL cannot read world files using commas in place of a period as the decimal point (ie. typical of the "de" locale for instance).

Please modify the worldfile reading code to support either "." or "," as the decimal place regardless of the working locale. Basically, use the CPLAtof() function in place of atof().

(see GDALReadWorldFile() in gdal/gcore/gdal_misc.cpp)

Make sure a test of this is added to the test suite.

Change History (6)

comment:1 Changed 13 years ago by warmerdam

I'm working on this one tonight. 

comment:2 Changed 13 years ago by warmerdam

I have added a CPLAtofM() in cpl_strtod.cpp which accepts either "," or "." 
regardless of locale.  It turns out that CPLAtof() only accepts "." regardless
of locale. 

Also added this into GDALReadWorldFile() in gdal_misc.cpp, and also the
.tab reader and the RPC metadata reading. 

Also added a test for this functionality in autotest/gdrivers/png.py via
the new test.wld mixed locale file in data.

All changes are in trunk.  I'm considering backporting to 1.4.x.

comment:3 Changed 13 years ago by warmerdam

I have confirmed correct operation on windows, but attempts to merge have
been so far unsuccessful.  The changes are in:

 -r 10716:10712

Revisit tomorrow...

comment:6 Changed 13 years ago by warmerdam

Description: modified (diff)
Milestone: 1.4.1

comment:7 Changed 13 years ago by warmerdam

Description: modified (diff)

comment:8 Changed 13 years ago by warmerdam

Resolution: fixed
Status: assignedclosed

Patch backported to 1.4 branch.

Note: See TracTickets for help on using tickets.