Bug Tracker

Modify

Ticket #11371 (closed enhancement: invalid)

Opened 15 months ago

Last modified 15 months ago

$.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

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 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.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.