Bug #6587
openstod() problem
0%
Description
Hello!
Randomly I'm receiving this message in WT log: "WContainerWidget: error parsing: 412.6666564941406;0: stod() of 412.6666564941406 failed".
And after this message my WT-based sample program's UI stops responding.
I've added additional logging to Wt::Utils::stod() function and this is what I saw:
"pos: '3' v.length(): '17' result: '412,000000'"
So the problem is in my decimal point which is "," and not ".".
stod() stops parsing on dot and Wt::Utils::stod() throws exception.
Updated by Roel Standaert about 6 years ago
Could you possibly share the source code of your sample program, or is that not possible?
Are you setting a different global locale instead of the default C locale? I know that Wt does not currently deal with different global locales properly in several places, i.e. uses of std::stringstream
, std::to_string
, std::stod
etc.
Updated by Alexander Paukonen about 6 years ago
Sadly my testing code is a mess ATM, I will try to make a decent error demo program later.
There are no locale-specific calls in the code, it is using C locale.
Updated by Roel Standaert about 6 years ago
- Priority changed from High to Low
I've recently pushed a commit that changes the implementation of stod, making it locale-independent.
This is only one case, though. If the global locale is modified, then Wt can break in a lot more places still. There are still uses of std::to_string
, etc. strewn about.
While this is a personal pet peeve of mine, this turns out not to be a major issue, since we rarely get comments about it. Surely something somewhere is changing your global locale, I can't see any other explanation.
Updated by Alexander Paukonen about 6 years ago
Thank you, I will try this new implementation.
Also will investigate the state of app's locale more closely.
Updated by Roel Standaert almost 6 years ago
- Target version changed from 4.0.5 to 4.1.0