Getting Error DataTables warning: table id=employee-grid - Invalid JSON response

Getting Error DataTables warning: table id=employee-grid - Invalid JSON response

Sanit KaleSanit Kale Posts: 17Questions: 4Answers: 0

I am Getting Error Invalid JSON I am Showing Address, CompanyName, Street In Datatable And for some users, there are German, French Characters.
while showing it in Datatable its Getting Invalid JSON.

I don't know why it is throwing Error for Non-ASCII Characters ??

Answers

  • colincolin Posts: 2,784Questions: 0Answers: 487

    Hi @Sanit Kale ,

    If you're having problems with non-ascii characters, it's most likely something to do with your UTF8 settings. Take a look at this thread, this should help.

    Cheers,

    Colin

  • allanallan Posts: 48,301Questions: 1Answers: 6,971 Site admin

    Beyond that, what is being returned from the server that is not valid JSON? It might contain a useful error message.

    Allan

  • Sanit KaleSanit Kale Posts: 17Questions: 4Answers: 0

    I have Converted all Database Into Utf8mb4 and still, i am getting the same error

    The thing is i have junk Address and if I remove Space or single character from that address (not junk character) then Its working fine.

           22nd Floor, Building F Dong Fang Jun Zuo Chi Le Chuan Boulevard Ruyi 
           District, ë 
    

    If i remove any space from above address its working

  • allanallan Posts: 48,301Questions: 1Answers: 6,971 Site admin

    Have you checked the response from the server as I suggest above? Does it contain an error message? If not, then check your server's error logs.

    Allan

  • Sanit KaleSanit Kale Posts: 17Questions: 4Answers: 0

    Thank Allan for a reply

    Actually, I am not getting any response from the server, I ran a query to search for HOP Character When I paste that Character here I am not able to see that HOP Character so I have attached the screen Shot. I am removing this character manually from the database but not found any solution.

  • allanallan Posts: 48,301Questions: 1Answers: 6,971 Site admin

    Did you check the server's error logs? My guess is that json_encode() is objecting to that character, but I can't be certain.

    Allan

  • Sanit KaleSanit Kale Posts: 17Questions: 4Answers: 0

    What needs to be done to make it work ?

  • tangerinetangerine Posts: 2,162Questions: 15Answers: 238

    Did you check the server's error logs?

  • Sanit KaleSanit Kale Posts: 17Questions: 4Answers: 0

    Actually I dumped json data and found �zveren this character in LastName Field.

  • Sanit KaleSanit Kale Posts: 17Questions: 4Answers: 0

    I am not getting any response from server

  • Sanit KaleSanit Kale Posts: 17Questions: 4Answers: 0

    actual LantName is Özveren

  • allanallan Posts: 48,301Questions: 1Answers: 6,971 Site admin

    Its a character encoding issue. As I asked before, and tangerine highlighted, please check your server's error logs. Not the response from the server. The error logs.

    You probably need to use UTF8 or whatever character set you need consistently. It sounds like the database table might be in some other encoding.

Sign In or Register to comment.