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: 23Questions: 9Answers: 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 ??

This question has an accepted answers - jump to answer

Answers

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

    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: 63,455Questions: 1Answers: 10,465 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: 23Questions: 9Answers: 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: 63,455Questions: 1Answers: 10,465 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: 23Questions: 9Answers: 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: 63,455Questions: 1Answers: 10,465 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: 23Questions: 9Answers: 0

    What needs to be done to make it work ?

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    Did you check the server's error logs?

  • Sanit KaleSanit Kale Posts: 23Questions: 9Answers: 0

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

  • Sanit KaleSanit Kale Posts: 23Questions: 9Answers: 0

    I am not getting any response from server

  • Sanit KaleSanit Kale Posts: 23Questions: 9Answers: 0

    actual LantName is Özveren

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

    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.

This discussion has been closed.