Reputation: 23
Does someone have an idea please? My problem is that the result that my query SQL which is in Arabic is displayed with characters like that ع٠"ÙŠÙ ‡ اÙ". While I do all:
// CONNEXION BDD
$pdo = new PDO('mysql:host=localhost;dbname=jeu', 'root', '', array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING,
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\''
));
<?php
require_once('inc/init.inc.php');
$req= $pdo -> query("select * from proposition ");
while($data=$req -> fetch(PDO::FETCH_ASSOC)){
echo' <form action="" method="post">';
echo $data['question'].'<br />';
echo $data['id_propo'].'<br />';
echo '<input type="radio" name="rep" value='.$data["rep1"].'+'.$data['id_propo'].' />'.$data['rep1'].'<br />';
echo '<input type="radio" name="rep" value='.$data["rep2"].'+'.$data['id_propo'].' />'.$data['rep2'].'<br />';
echo '<input type="radio" name="rep" value='.$data["rep3"].'+'.$data['id_propo'].' />'.$data['rep3'].'<br />';
echo '<input type="radio" name="rep" value='.$data["rep4"].'+'.$data['id_propo'].' />'.$data['rep4'].'<br /><br />';
}
echo '</form>';
?>
Upvotes: 0
Views: 433
Reputation: 21
You need to convert your database to utf8mb4_general_ci type instead of utf8. This is the best choice for you i think. Also check that you have applied a html header:
<meta charset=”utf-8”>
Upvotes: 1