Project

General

Profile

Actions

Bug #6587

open

stod() problem

Added by Alexander Paukonen over 5 years ago. Updated over 5 years ago.

Status:
New
Priority:
Low
Assignee:
-
Target version:
Start date:
09/05/2018
Due date:
% Done:

0%

Estimated time:

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.

Actions #1

Updated by Roel Standaert over 5 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.

Actions #2

Updated by Alexander Paukonen over 5 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.

Actions #3

Updated by Roel Standaert over 5 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.

Actions #4

Updated by Alexander Paukonen over 5 years ago

Thank you, I will try this new implementation.

Also will investigate the state of app's locale more closely.

Actions #5

Updated by Roel Standaert over 5 years ago

  • Target version changed from 4.0.5 to 4.1.0
Actions

Also available in: Atom PDF