RESOLVED FIXED16717
parseFloat fails if string has trailing Euro symbol
https://bugs.webkit.org/show_bug.cgi?id=16717
Summary parseFloat fails if string has trailing Euro symbol
rad2008
Reported 2008-01-03 00:45:56 PST
Parsing a float with parseFloat() doesn't work with Euro symbol suffix. Sample script: <script> alert(parseFloat("1.0€")); </script> parseFloat returns NaN and NOT the expected value as float object; This script works as expected: <script> alert(parseFloat("1.0$")); </script> My Test System: Windows XP SP2 Safari 3.0.4 beta (523.15) with WebKit-r28899
Attachments
Mark Rowe (bdash)
Comment 1 2008-01-03 01:23:36 PST
Confirmed on Mac OS X with both Safari 3.0.4 and TOT WebKit.
Mark Rowe (bdash)
Comment 2 2008-01-03 01:36:40 PST
From ustring.cpp: 954 // FIXME: If tolerateTrailingJunk is true, then we want to tolerate non-8-bit junk 955 // after the number, so is8Bit is too strict a check. 956 if (!is8Bit()) 957 return NaN;
Derk-Jan Hartman
Comment 3 2010-02-22 12:50:58 PST
This bug is a duplicate of Bug 31349
Derk-Jan Hartman
Comment 4 2010-06-10 17:59:17 PDT
This major data processing Javascript function is still broken....
Darin Adler
Comment 5 2010-06-10 22:02:56 PDT
Well, if it’s major, then ... ;-)
Darin Adler
Comment 6 2010-06-10 22:03:29 PDT
Well, to be serious, I was looking at this code recently and thinking I wanted to fix it, so I’ll grab this bug.
Darin Adler
Comment 7 2010-06-16 22:20:06 PDT
*** Bug 31349 has been marked as a duplicate of this bug. ***
Darin Adler
Comment 8 2010-06-16 22:24:42 PDT
kangax
Comment 9 2010-06-16 22:32:27 PDT
However `Number('\u00A0')` still returns `NaN` (in today's nightly), so bug 31349 seems to be still in effect.
Note You need to log in before you can comment on or make changes to this bug.