user1320722
user1320722

Reputation: 43

phpmyadmin displaying utf8 but site doesnt

i created a table named 'items' with collation of utf-8_bin and when i went on inserting data, i inserted it in devnagari, for nepali, it all went good and when it came to displaying records, all the devnagari fonts will display as question marks like if i have written निश्चल then it would show up as ??????? but it shows correctly in phpmyadmin, i have already declared to use utf-8 on my page also, here is the header section of my page.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta charset="utf-8" />
</head>
<?php
$sql="SELECT * FROM `swyamsewika`.`items`";
mysql_connect("localhost","root","");
$query=mysql_query($sql);
$a=mysql_fetch_array($query);
var_dump($a);
?>

if i type निश्चल in the page then it shows correctly. when i type in database and then retrieve using php, then it gets into ????? please help me as soon as possible...

Upvotes: 1

Views: 860

Answers (2)

aBogdan
aBogdan

Reputation: 180

In phpmyadmin go to the Options tab and scroll down to Collation and chose a proper collation for your language.

For further reading on charsets, go to https://dev.mysql.com/doc/refman/5.5/en/charset-charsets.html

Upvotes: 0

voodoo417
voodoo417

Reputation: 12101

may set in my.ini(mysql)

character-set-server = utf8 

init-connect = "set names utf8"

Upvotes: 1

Related Questions