Bug Tracker

Opened 8 years ago

Closed 8 years ago

#11371 closed enhancement (invalid)

$.parseJSON on utf-8 with BOM

Reported by: muhammad.sherafat@… Owned by: muhammad.sherafat@…
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:

Description

Hello dears; for resolving the problem of bom in parsing json we must first search '{' character and then parse the input string from index of this char to end of input string; I have a thanks of you if you implement this in the $.parseJSON itself; for example: function doAjax() {

$.ajax({

url: "ajax.aspx", data: { "dt": "Ali" }, type: "POST", contentType: "application/json; charset=utf-8", dataType:"json", success: function (msg) {

try {

var x = msg.substr(msg.indexOf('{')); var r = $.parseJSON(x); $("#di1").html(r.data1); $("#di2").html(r.data2);

} catch (e) {

alert(e.toString());

}

}

});

}

thanks alot by

Change History (2)

comment:1 Changed 8 years ago by dmethvin

Owner: set to muhammad.sherafat@…
Status: newpending

Our intention with jQuery.parseJSON is to implement a cross-browser JSON.parse and nothing more. What do browsers do if you pass them a string with a BOM prefix? Can you provide a test case and your results in jQuery's supported browsers?

comment:2 Changed 8 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

Note: See TracTickets for help on using tickets.