Closed Bug 23612 Opened 26 years ago Closed 26 years ago

JavaScript mishandles characters \u001C - \u001F

Categories

(Core :: JavaScript Engine, defect, P3)

All
Mac System 8.6
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: waldemar, Assigned: rogerl)

Details

(Keywords: js1.5)

ECMAScript states that characters \u001C - \u001F in program source should be treated as syntax errors. Our engine treats them as whitespace. js> eval("2\u0018+4") 3: SyntaxError: illegal character: 3: 2+4 3: .^ This is correct. js> eval("2\u001F+4") 6 This should also generate a syntax error.
Assignee: mccabe → rogerl
Forwarding to Roger.
Keywords: js1.5
This bug is most easily fixed by changing entries 0x1C through 0x1F of js_Y[] in jsstr.c from 1 to 0.
Do regexps classify those characters the same as the lexical grammar does? The js_Y table (based on Java code) is used for both, IIRC. /be
testcase ecma_3/Unicode/uc-001-n.js added
According to ECMA, regexps should not treat these characters as white space either. If regexps use the same table, then this fix would fix both problems. We might want to add a test case for testing these characters against \s in a regexp.
Added ecma_3/Unicode/uc-004.js testcase to cover regexp usage.
Fix checked in.
Status: NEW → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
Marking Verified.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.