Returning control codes as JSON to a jquery ajax json call

Posted by Graham on Stack Overflow See other posts from Stack Overflow or by Graham
Published on 2013-06-28T09:54:48Z Indexed on 2013/06/28 10:21 UTC
Read the original article Hit count: 355

Filed under:
|
|

I want to know if it is possible to return ascii control codes in JSON format from classic ASP to a jQuery ajax call.

This is my jQuery call:

$.ajax({
    url: "/jsontest.asp",
    type: "POST",
    cache: false,
    dataType: "json",
    complete: function(data)
    {
        var o = $.parseJSON(data.responseText.toString());
    },
    error: function(data1, data2)
    {
        alert("There has been an error - please try again");
    }
});

This is my called page:

{"val1":123,"val2","abcdef"}

The above works fine, but if I change my called page to include ascii character 31 (1F) like so:

{"val1":123,"val2","abc\x1Fdef"}

then I get the alert in my error function. Can this be done, and if so, how please.

Note: I'm using jQuery 1.7.1 and both IIS 6 and IIS 7

I have tried: \x1f, %1f, and \u001f

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about JSON