Ticket #1414 (closed defect: fixed)

Opened 6 years ago

Last modified 6 years ago

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: neteler

Description (last modified by warmerdam) (diff)

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

Changed 6 years ago by warmerdam

I'm working on this one tonight. 

Changed 6 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.

Changed 6 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...

Changed 6 years ago by warmerdam

  • description modified (diff)
  • milestone set to 1.4.1

Changed 6 years ago by warmerdam

  • description modified (diff)

Changed 6 years ago by warmerdam

  • status changed from assigned to closed
  • resolution set to fixed

Patch backported to 1.4 branch.

Note: See TracTickets for help on using tickets.