Opened 11 years ago
Closed 11 years ago
#11371 closed enhancement (invalid)
$.parseJSON on utf-8 with BOM
Reported by: | Owned by: | ||
---|---|---|---|
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 11 years ago by
Owner: | set to [email protected]… |
---|---|
Status: | new → pending |
comment:2 Changed 11 years ago by
Resolution: | → invalid |
---|---|
Status: | pending → closed |
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!
Our intention with
jQuery.parseJSON
is to implement a cross-browserJSON.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?