From 1f3abbeb859b4a4c83a7822b39ce36eb39b7a3dd Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Sun, 1 Sep 2013 13:34:44 -0400 Subject: Fix grids with comma as decimal separator [Bug #1216306]. Fixed bugs: - https://launchpad.net/bugs/1216306 (bzr r12498) --- src/util/units.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/util/units.cpp') diff --git a/src/util/units.cpp b/src/util/units.cpp index 7bc910fcc..3fdd77916 100644 --- a/src/util/units.cpp +++ b/src/util/units.cpp @@ -227,9 +227,10 @@ Quantity UnitTable::getQuantity(Glib::ustring const& q) const // Extract value double value = 0; - Glib::RefPtr value_regex = Glib::Regex::create("[-+]*[\\d+]*\\.*[\\d+]*[eE]*[-+]*\\d+"); + Glib::RefPtr value_regex = Glib::Regex::create("[-+]*[\\d+]*[\\.,]*[\\d+]*[eE]*[-+]*\\d+"); if (value_regex->match(q, match_info)) { - value = atof(match_info.fetch(0).c_str()); + std::istringstream tmp_v(match_info.fetch(0)); + tmp_v >> value; } // Extract unit abbreviation -- cgit v1.2.3