I've such a problem , first take a look at mysql table =>
CREATE TABLE IF NOT EXISTS users(
id int(4) NOT NULL AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(40) CHARSET utf8 COLLATE 'utf8_unicode_ci' NOT NULL,
surname VARCHAR(40) CHARSET utf8 COLLATE 'utf8_unicode_ci' NOT NULL,
);
It is storing data successfully , but when I'm trying to retrieve this info to my .php file (which encoding is also utf8) it still showing me question marks (?????), why ? How can I solve it ?
UPDATE
Something I'm not doing well. So I've 2 php files, one is classA.php file in which I've defined class which is retrieving info from database and I've included this file (classA.php) into my default.php file where I want to see data. I've exactly same table which is written above , and I'm writing
header('Content-Type: text/html; charset=UTF-8');
in the first line in default.php, but it still doesn't work, thanks for advices :))
SECOND UPDATE
This script I've in classA.php file , and its encoding is default like default.php file encoding. I just added in default.php file in first line this
header("Content-Type: text/html; charset=UTF-8");
but it still doesn't work.
Third update
sql =>
create table ok(
id int(2) not null auto_increment primary key,
name varchar(20) charset utf8 not null);
and php file
<?php
header('Content-Type: text/html; charset=UTF-8');
?>
<!DOCTYPE html>
<html>
<head>
<title>hello</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<?php
$con = mysqli_connect("host","user","pass","db");
if (mysqli_connect_errno()==0){
if ($r = mysqli_query($con,"SELECT * FROM ok")){
mysqli_set_charset($con,"utf8");
while ($d = mysqli_fetch_assoc($r)){
echo $d['name'] . "<br>";
}
}
}
if (isset($con)){
mysqli_close($con);
}
?>
</body>
</html>
I've inserted in ok table this=>
insert into ok(name) values("one"),("ერთი"),("two"),("ორი");
PS. special characters are Georgian :)
and it results English characters fine and Georgians with question marks :(
It doesn't work anyways :(