ASCII - Invalid JSON Response

ASCII - Invalid JSON Response

MikeyMatouMikeyMatou Posts: 4Questions: 2Answers: 0

Couldn't find a topic specific to this.

I have a datatable with one column which holds quite random information. An example from this column are the characters ✔️ᵛᵉʳᶦᶠá , with this result causing the specific datatable page it was on to be inaccessible due to the improper json (invalid json response). The other pages work fine.

Is there a recommended way to get around this? The data comes from the ajax method (serverside php) and I've been unable to properly sanitize the specific column (only need just the one column).

Thanks.

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @MikeyMatou ,

    Have you tried specifying the contentType as discussed in this StackOverflow thread?

    Cheers,

    Colin

  • MikeyMatouMikeyMatou Posts: 4Questions: 2Answers: 0
    edited May 2018

    Unfortunately, I just tried to no avail @colin . Still the same issue.

  • kthorngrenkthorngren Posts: 21,299Questions: 26Answers: 4,945

    Have you tried the steps in the link provided in the error?
    https://datatables.net/manual/tech-notes/1

    Specifically using jsonlint. Can you provide an example of your JSON response?

    Kevin

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hate to say it, I think you just have to poke around the web - it's not a DataTables issue as such. This link may help, as may this.

    C

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    Is it binary data rather than encoded text? If it is encoded text then it sounds like a character encoding issue - JSON is UTF8, so you need to create the JSON as UTF8 on the server-side.

    If its binary data, then you'd probably need to strip it since that can indeed be invalid UTF8.

    Allan

This discussion has been closed.