Closed Bug 207261 Opened 21 years ago Closed 21 years ago

DOM escape() fails to escape DEL character

Categories

(Core :: DOM: Core & HTML, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: kelly, Unassigned)

References

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3.1) Gecko/20030425
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3.1) Gecko/20030425

the Mozilla implementation of the "Global.escape()" method fails to escape the
US-ASCII character DEL (127 or 0x7F) and will instead truncate the escaping
string at the first occurrance of the DEL character.



Reproducible: Always

Steps to Reproduce:
1. add the following to a web page in a javascript example:
<script
language="javascript">alert(escape("te"+String.fromCharCode(127)+"st"));</script>
2. load the page in any mozilla browser.
Actual Results:  
you will receive an alert containing the text "te".

Expected Results:  
You should receive an alert containing the text "te%7Fst".

Although we have only tested within the standard 8-bit ASCII character set, only
the DEL character has proven to be a problem so far.
Confirming bug with Mozilla trunk binary 2003052304 on WinNT.
But this is not malfunctioning in JS Engine, as the following
session in the standalone JS shell demonstrates:

js> print(escape("te"+String.fromCharCode(127)+"st"));
te%7Fst


Note the testcase for the browser can be simplified to:

         javascript:alert(escape("te\u007Fst"));
     or  javascript:alert(escape("te\x7Fst"));

Both of these work in IE6 and NN4.7: ---> "te%7Fst".
But not in Mozilla, which outputs ------> "te".

In the browser, the escape() function of the DOM supersedes
the JS Engine escape(). Reassigning to DOM Level 0 component.

Related bugs:

bug 44272
javascript escape() and unescape() don't work properly with unicode chars
bug 153325
javascript href broken when a variable is containing escaped umlaut
bug 192148
ECMA-262 compliance: escape('@') should not escape
Assignee: rogerl → dom_bugs
Status: UNCONFIRMED → NEW
Component: JavaScript Engine → DOM Level 0
Ever confirmed: true
QA Contact: pschwartau → ashishbhatt
Summary: JavaScript Global.escape() fails to escape DEL character → DOM escape() fails to escape DEL character
Depends on: 44272
This was fixed along with bug 44272. 
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.