Possible bug: rti::topic::to_string yields different results depending on the locale

1 post / 0 new
Offline
Last seen: 11 months 20 hours ago
Joined: 05/10/2016
Posts: 5
Possible bug: rti::topic::to_string yields different results depending on the locale

I think we may have found a bug in rti::topic::to_string that affects both backends (XML and JSON). Looks like samples with fields of type double are rendered to string according to the current system locale. In my case the system locale is es_ES.utf8, which uses a comma as the decimal point:

$ locale -k LC_NUMERIC
decimal_point=","
thousands_sep="."

As stated, to_string seems to lookup the decimal separator in the locale to render the number, because using either XML or JSON the numbers are rendered like "0,5435345" instead of "0.5435345", which causes a syntax error in the JSON rti::topic::to_string.

When running our binaries with the american locale (en_US.utf8) the numbers are rendered using the point as the decimal separator, but switching the locale is not an option.

Keywords: