Server-Error: "Invalid UTF-8 sequence" server_processing.php on line 163
Server-Error: "Invalid UTF-8 sequence" server_processing.php on line 163
Rockb
Posts: 97Questions: 0Answers: 0
Hello, actually the table works fine. But my server-error-log says:
[Wed Mar 02 14:50:17 2011] [error] [client xyz] PHP Warning: json_encode() [[a href='function.json-encode']function.json-encode[/a]]: Invalid UTF-8 sequence in argument in /xyz/server_processing.php on line 163, referer: http://xyz.com
Any idea, where the problem is?
[Wed Mar 02 14:50:17 2011] [error] [client xyz] PHP Warning: json_encode() [[a href='function.json-encode']function.json-encode[/a]]: Invalid UTF-8 sequence in argument in /xyz/server_processing.php on line 163, referer: http://xyz.com
Any idea, where the problem is?
This discussion has been closed.
Replies
{"fnRender": function ( oObj ) { return '' + oObj.aData[2] +''; }, "aTargets": [ 2 ]},
The strange thing: It works, but the server error logs are not happy about it. Why?
Allan
In this answer there is also the other answer for this topic here, or? http://stackoverflow.com/questions/1790425 /invalid-php-json-encoding/1790454#1790454 BUT WHERE is the json output, where I'Ve to add this line?
Allan
header('Content-Type: application/json; charset=utf-8', true,200);
echo json_encode( $output );
still the same server error.
Allan
Allan
So, I replaced the following part (line 127 in http://www.datatables.net/development/server-side/php_mysql):
[code]$rResult = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());[/code]
with
[code]mysql_query("SET character_set_results=utf8", $gaSql['link']);
$rResult = mysql_query( $sQuery ) or die(mysql_error());[/code]
Thanx, Allan! :-) You're fantastic.
Allan