Ticket #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: | ||
| Blocking: | Blocked by: |
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
comment:1 Changed 15 months ago by dmethvin
- Owner set to muhammad.sherafat@…
- Status changed from new to pending
comment:2 Changed 15 months ago by trac-o-bot
- Status changed from pending to closed
- Resolution set to invalid
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!
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

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?