Project

General

Profile

Bug #7794

WProgressBar can generate invalid HTML code.

Added by Andreas Frolov about 1 month ago. Updated about 1 month ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
10/22/2020
Due date:
% Done:

0%

Estimated time:

Description

The method WProgressBar::updateBar(...) uses locale-dependent function std::to_string to convert a double into a string. For some locals this can lead to the generation of invalid HTML code.

E.g. this code

`std::locale::global(std::locale("de_BE"));

auto pb = std::make_uniqueWt::WProgressBar();
pb->setValue(65);

Wt::WDialog dialog("ProgressBar");
dialog.contents()->addWidget(std::move(pb));
dialog.exec();`

generates the following HTML

<div id="barof0yz1o" class="Wt-pgb-bar" style="width:65,000000%;"></div>

Browser deactivates the style because the width is invalid.

#1

Updated by Roel Standaert about 1 month ago

Yeah, I haven't gotten around to eliminating all of these global locale dependent parts of Wt yet.

At the moment it is advised not to set a global locale when using Wt.

Also available in: Atom PDF