Bug 16717 - parseFloat fails if string has trailing Euro symbol
Summary: parseFloat fails if string has trailing Euro symbol
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 523.x (Safari 3)
Hardware: All All
: P2 Major
Assignee: Darin Adler
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-03 00:45 PST by rad2008
Modified: 2010-06-16 22:32 PDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rad2008 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
Comment 1 Mark Rowe (bdash) 2008-01-03 01:23:36 PST
Confirmed on Mac OS X with both Safari 3.0.4 and TOT WebKit.
Comment 2 Mark Rowe (bdash) 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;


Comment 3 Derk-Jan Hartman 2010-02-22 12:50:58 PST
This bug is a duplicate of Bug 31349
Comment 4 Derk-Jan Hartman 2010-06-10 17:59:17 PDT
This major data processing Javascript function is still broken....
Comment 5 Darin Adler 2010-06-10 22:02:56 PDT
Well, if it’s major, then ... ;-)
Comment 6 Darin Adler 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.
Comment 7 Darin Adler 2010-06-16 22:20:06 PDT
*** Bug 31349 has been marked as a duplicate of this bug. ***
Comment 8 Darin Adler 2010-06-16 22:24:42 PDT
This was fixed in <http://trac.webkit.org/changeset/56560>.
Comment 9 kangax 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.