While testing evolution-data-server / libical on a Linux system with the
locale set to "fr_FR.utf8", I noticed that the floating point values were
being saved incorrectly in the the VEVENT.
They would look like "GEO:10\,000000\;11\,000000" instead of
After looking at the code of libical, I identified the root cause in
icalvalue_float_as_ical_string_r() and icalvalue_geo_as_ical_string_r() are
using snprintf to convert the float values into strings.
However, according to the snprintf man page:
For some numeric conversions a radix character ("decimal point") or
thousands' grouping character is used. The actual character used depends on
the LC_NUMERIC part of the locale. The POSIX locale uses '.' as radix
character, and does not have a grouping character. Thus,
results in "1234567.89" in the POSIX locale, in "1234567,89" in the nl_NL
locale, and in "1.234.567,89" in the da_DK locale.
I have libical 0.46 on my test system but this part of the code seems to be
the same in svn trunk.
I believe that another function than snprintf should be used to convert the
values, one that is not locale-aware. Alternatively, it is possible to
change the locale to "C" before the snprintf() call and restore the locale
after (see attached patch).
The second solution seems to be used in inkscape for example (
This, however, is probably not thread-safe.
Linux Software Engineer, PhD
Intel Finland Oy - Open Source Technology Center
Get latest updates about Open Source Projects, Conferences and News.