Skip to main content

Bug Tracker

Side navigation

#11371 closed enhancement (invalid)

Opened February 22, 2012 03:55AM UTC

Closed March 07, 2012 08:04AM UTC

$.parseJSON on utf-8 with BOM

Reported by: muhammad.sherafat@yahoo.com Owned by: muhammad.sherafat@yahoo.com
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

Attachments (0)
Change History (2)

Changed February 22, 2012 03:59AM UTC by dmethvin comment:1

owner: → muhammad.sherafat@yahoo.com
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?

Changed March 07, 2012 08:04AM UTC by trac-o-bot comment:2

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!