You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
auto number = std::stod(std::string{ sv.token() });
The problem is that std::stod converts data using your locale hrence if your locale has the comma (,) as the decimal separator the parsing will not work correctly since the DBC standard uses the dot ..
My locale is it_IT.UTF-8 and unfortunately the decimal separator is the comma.
When CANdb parses the following signal in the dbc file:
I found a "bug" in the parsing of numbers. As of now the parsing is handled by the following line:
CANdb/src/dbcparser.cpp
Line 159 in 150c42a
The problem is that
std::stod
converts data using your locale hrence if your locale has the comma (,
) as the decimal separator the parsing will not work correctly since the DBC standard uses the dot.
.My locale is
it_IT.UTF-8
and unfortunately the decimal separator is the comma.When CANdb parses the following signal in the dbc file:
It will parse
factor=0
instead of0.04
andoffset=-273
instead of-273.15
I changed my environment variable when using CANdb to
en_US-UTF.8
and now it works.I think the solution is to define the parsing locale in the libary itself or better: change the conversion function to not use locale at all.
The text was updated successfully, but these errors were encountered: