Invalid JSON response when adding some utf-8 characters
Invalid JSON response when adding some utf-8 characters
trinq
Posts: 3Questions: 0Answers: 0
Hi,
I have some problem with DataTables 1.10 and server-side script. Everything works well when I import to MySQL table CSV data without German and Polish characters, but when I add some of this specific characters, I instantly receive an Invalid JSON response error. All of settings in phpmyadmin database is set to utf-8 as well as main php file. I would be gratefull for any help.
This discussion has been closed.
Replies
What is the server sending back that makes it invalid JSON? See tech note 1 to find out how to get this information. In future, please also follow the forum rules and link to a test case showing the problem.
Allan
Hi Allan, thanks for reply. The thing is, when I check XHR tab it shows no data at all, only "This request has no response data available" When I clear MySQL table and import the same CSV data, but with manualy deleted special characters, all works like a charm.
That's not valid JSON :-). It sounds like there is an error in the server-side script. Have you got error logging enabled and have you checked the error logs?
Allan
Yes, I have and it show nothing. I post my php files:
index.php:
server_processing.php:
With no errors, there is not much to go on I'm afraid. In fact, I can't even begin to guess what is going wrong. I'd suggest that you add some debugging statements into the code - I suspect that there is an error occurring and it isn't showing up.
Allan
Hi!
I solve it with this change in spp.class.php. Only add htmlentitites()
Juli.
static function data_output ( $columns, $data )
{
$out = array();
Very good julicrack !!! I am the several days racking my brain and doing research in the forum to resolve this problem (beginner thing). Someone has to document this improvement in code so that beginners like me do not give up to use this wonderful plug-in. Now I have a difinitiva solution to charge thousands of rows from a database table.
Great solution, however the texts with international characters such as "áéűúőóüö" still didnt appear.
I added this line to the function sql_connect() in spp.class.php before returning the $db object and now it works.
$db->exec("set names utf8");