#620 bug
Paul Alexandrow

Error in X-JSON header handling

Reported by Paul Alexandrow | March 26th, 2009 @ 02:11 PM

The problem is in the following line in Ajax.Response._getHeaderJSON:

json = decodeURIComponent(escape(json));

Despite the fact that I don't see it's point (though I guess there is one) here's the problem: encodeURIComponent() and escape() produce different outputs for certain characters (at least here on FF 3.0.7):

escape("abcö") --> abc%F6 encodeURIComponent("abcö") --> abc%C3%B6

Therefore, decodeURIComponent() can't decode such characters encoded by escape() and throws an error:

decodeURIComponent("abc%F6") --> "malformed URI sequence"

This results in the whole response-handling being aborted.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Prototype JavaScript library.

Shared Ticket Bins