I get French characters who look like this é but are ç for example. I am using jQuery Ajax and making a DataTable with PHP (Code-Igniter), fetch data from database and then make json_encode datastring for DataTable, it gives error “Invalid JSON response”. I have try many things but nothing seems to get rid of the problem and I know it's because of json_encode because if i make a simple table using PHP (Code-Igniter) everything works fine.
controller.php
query...;
foreach ($ListOfAirport as $airport):
$slot_time_a2 = array();
foreach ($Session2timeing as $s2):
$sql = "SELECT
col1,
col2,
col3... FROM
table1LEFT JOIN table2
ON
table2.
table2_id=
table1.
table1_idWHERE
some cluse`";
$result2 = $this->common->CustomQueryROw($sql);
some conditions....
endforeach;
$dataarray[] = array('<b>' . $airport['airport_name'] . '</b>', $slot_time_a2[0], $slot_time_a2[1], $slot_time_a2[2], $slot_time_a2[3], $slot_time_a2[4], $slot_time_a2[5], $slot_time_a2[6]);
endforeach;
echo '{';
echo '"draw": ' . $_GET['draw'] . ',
"recordsTotal": ' . $this->outputData['totalrecord'] . ',
"recordsFiltered": ' . $this->outputData['totalrecord'] . ',';
echo '"data":';
echo json_encode($dataarray);
echo "}";
Before this ‘ç’ French character everything working well but after the insertion of this character in database, DataTable gives error “Invalid JSON response”.