View Single Post
Posts: 39 | Thanked: 13 times | Joined on May 2006 @ Bonn, Germany
#98
write_gpx() observes LC_NUMERIC when writing out lat and lon, thus if you are using (e.g.) german localization, a comma instead of a dot is used as decimal separator, and 50,123456 instead of 50.123456, is written to the gpx file.

When these files are later read in by parse_gpx(), which does not observe LC_NUMERIC, only the digits up to the comma are accepted, e.g. 50 instead of 50,123456.

As a workaround I have to treat maemo-mapper generated gpx-files with sed 's/,/\./g' to be able to open them again with maemo-mapper. A fix would be to embrace the code in write_gpx() with setlocale():
Code:
locale = setlocale(LC_NUMERIC, NULL); /* save current locale */
setlocale(LC_NUMERIC, "C"); /* set C locale */
... write gpx data to file ...
setlocale(LC_NUMERIC, locale) /* restore current locale */