After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 706786 - geocode-reverse constructor is not locale safe
geocode-reverse constructor is not locale safe
Status: RESOLVED FIXED
Product: geocode-glib
Classification: Other
Component: general
unspecified
Other Linux
: Normal major
: ---
Assigned To: geocode-glib maintainer(s)
geocode-glib maintainer(s)
Depends on:
Blocks: 706726
 
 
Reported: 2013-08-26 10:02 UTC by Jonas Danielsson
Modified: 2013-08-26 17:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
geocode-reverse: Make constructor locale safe (2.14 KB, patch)
2013-08-26 10:26 UTC, Jonas Danielsson
none Details | Review
geocode-reverse: Make constructor locale safe v2 (1.88 KB, patch)
2013-08-26 10:28 UTC, Jonas Danielsson
none Details | Review
geocode-reverse: Make constructor locale safe v3 (1.86 KB, patch)
2013-08-26 12:52 UTC, Jonas Danielsson
committed Details | Review

Description Jonas Danielsson 2013-08-26 10:02:03 UTC
The constructor new_for_location does:

g_strdup_printf ("%g",  geocode_location_get_latitude (location)));

For latitude and location. With my locale sv_SE this will give a string with a comma as decimal point, which will break stuff. Reverse geocoding in maps did not work for me on one system unless i did LC_NUMERIC="en_US.UTF-8".

This should be fixed to be locale safe.
Comment 1 Jonas Danielsson 2013-08-26 10:26:37 UTC
Created attachment 253105 [details] [review]
geocode-reverse: Make constructor locale safe

When using g_strdup_printf and float values the radix character (decimal point) is locale dependent and for some locales will print a comma. This will break the nominatim queries for us.
    
Switch to using g_ascii_dtostr() instead which will always use a dot as decimal point.
Comment 2 Jonas Danielsson 2013-08-26 10:28:22 UTC
Created attachment 253106 [details] [review]
geocode-reverse: Make constructor locale safe v2

Now without debug g_printf
Comment 3 Jonas Danielsson 2013-08-26 12:52:58 UTC
Created attachment 253128 [details] [review]
geocode-reverse: Make constructor locale safe v3

And now without whitespace damage!