json problem {"data":Malformed UTF-8 characters, possibly incorrectly encoded
json problem {"data":Malformed UTF-8 characters, possibly incorrectly encoded
Swordm
Posts: 9Questions: 4Answers: 0
Hello, I purchased editor ,
during trial everything were normal but today I receive tis error ;
Malformed UTF-8 characters, possibly incorrectly encoded.
this is my code
$('#example').DataTable( {
dom: 'B<"clear">lfrtip',
ajax: "data/sod.php",
columns: [
on sod.php I have a query printing results as json..
echo '{"data":';
$rows = array();
$result = odbc_exec($conn, $query);
while($r=odbc_fetch_array($result))
{
$rows[] = $r;
}
print json_encode($rows);
echo json_last_error_msg();
echo ',
"options": [],
"files": [],
"draw": 1
}';
This discussion has been closed.
Answers
Hi,
What database are you using? Is it set to be utf8 itself?
Thanks,
Allan
I am using DB2 database, I read from DB2 write to mysql,
first line solved my problem, second and third line can be an option but this time change all values on query.
it is better doing this in query but i could not.
this is the query line of error, i have added if null
IFNULL(CAST(CAST(TURKEY_SOD.SYVR01 as CHAR(40) FOR BIT DATA) as CHAR(40) CCSID 1026),0) AS ONOTES,
I fear that this is out of the scope of DataTables support. You'd probably need to ask on StackOverflow or a PHP forum. It sounds like the data being read from the database is either not utf8 encoded, or it has invalid utf8 characters in it.
Allan