Bug 16717
| Summary: | parseFloat fails if string has trailing Euro symbol | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | rad2008 <rad2008> |
| Component: | JavaScriptCore | Assignee: | Darin Adler <darin> |
| Status: | RESOLVED FIXED | ||
| Severity: | Major | CC: | ap, darin, hartman.wiki, kangax, mrowe |
| Priority: | P2 | ||
| Version: | 523.x (Safari 3) | ||
| Hardware: | All | ||
| OS: | All | ||
rad2008
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 | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Mark Rowe (bdash)
Confirmed on Mac OS X with both Safari 3.0.4 and TOT WebKit.
Mark Rowe (bdash)
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
This bug is a duplicate of Bug 31349
Derk-Jan Hartman
This major data processing Javascript function is still broken....
Darin Adler
Well, if it’s major, then ... ;-)
Darin Adler
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
*** Bug 31349 has been marked as a duplicate of this bug. ***
Darin Adler
This was fixed in <http://trac.webkit.org/changeset/56560>.
kangax
However `Number('\u00A0')` still returns `NaN` (in today's nightly), so bug 31349 seems to be still in effect.