strtod is locale dependent, so as xml_attribute::as_double and get_value_double
7ymekk opened this issue · 1 comments
7ymekk commented
There're 2 main decimal separators: comma and dot:
https://en.wikipedia.org/wiki/Decimal_separator#Countries_using_decimal_comma
If you save XML on e.g. UK locale computer and send that to a person in PL, then double values are gonna be converted to INT
char decimalComma[] = "123,123";
char decimalPoint[] = "123.123";
qDebug() << "--------" << strtod(decimalComma, 0) << strtod(decimalPoint, 0);
output depends on a locale:
- in PL, the output will be "123.123", "123"
- in UK, the output will be "123", "123.123"
it would be great if pugixml would handle that internally. We use QByteArrayView::toDouble() as a bypass for now.