unescape problem in Netscape 7

P

parksch2

Does anyone know why unescape would throw an error on certain special
characters?

I'm trying to unescape the string:

Espa%F1ol

It shou8ld display like this after it is unescaped:

Español

This works fine on IE but not in Netscape 7.

Thanks in advance.
 
M

Martin Honnen

Does anyone know why unescape would throw an error on certain special
characters?

Which error message exactly do you get?
I'm trying to unescape the string:

Espa%F1ol

var string = 'Espa%F1ol';
alert(unescape(string))

works fine for me with Netscape 7.2.
 
P

parksch2

Hey Martin, that's the weird part. A bit more information I found out:
it appears to only be breaking when the HTML is served from a dotnet
server. Can you think of any reason why this would be happening?
 
P

parksch2

I get the following error:

Exception... "Component returned failure code: 0x8000ffff
(NS_ERROR_UNEXPECTED) [nsIDOMWindowInternal.unescape]" nsresult:
"0x8000ffff (NS_ERROR_UNEXPECTED)" location: "JS frame ::
http://url.com/file.js :: FUNCTION :: Line: 398" data: no]
 
M

Martin Honnen

it appears to only be breaking when the HTML is served from a dotnet
server. Can you think of any reason why this would be happening?

Is that a static HTML document? Or HTML generated dynamically from an
ASP.NET application? If possible post a URL where the problem occurs and
tell us what needs to done on the page to trigger the error. I assume it
is an encoding problem.

Hmm, I have searched bugzilla and there have indeed been problems
related to page encoding and the escape/unescape behaviour and the
question whether to remain compatible to Netscape 4 or to current IE
releases, see
<https://bugzilla.mozilla.org/show_bug.cgi?id=212308>
<https://bugzilla.mozilla.org/show_bug.cgi?id=44272>

As I understand the problems have been fixed and Mozilla has been made
IE compatible for quite some while now (after 1.4) so please try Firefox
1.0 or Mozilla 1.7 or Netscape 7.2 whether the unescape problem you have
is fixed there.

I am not sure there is a workaround for those older Mozilla/Netscape
releases.
 
P

parksch2

Thanks for the help Martin. I finally found the problem:

On the .NET server, I had to change the encoding in the Web.config
from:
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />

to:
<globalization
requestEncoding="iso-8859-1"responseEncoding="iso-8859-1"/>

and now it works....

Not a great solution but at least a solution.

Thanks again for all the help!
 
V

VK

On the .NET server, I had to change the encoding in the Web.config
from:
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />
to:
<globalization requestEncoding="iso-8859-1"re­sponseEncoding="iso-8859-1"/>

Now you've got it.
The old unescape() method works with %XX encoded *ASCII* strings. If
you *may* use Unicode to communicate, you should use in your approach
decodeURIComponent() / decodeURI() methods. They support double-byte
chars.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top