So i made a inbox system and its stores the accents(í,é,ú etc..) like í,é,ú wich is perfect, but then i made another script and its storing the í's like à and i dont know why...
i have <meta charset="utf-8"> on both and mysql collation are both utf8
any one knows whats the problem?

in the html output(page) it shows it correct (í)
but its stores it in db like Ã
and i want to store it like &iacute;
thanks in advance

Recommended Answers

When connected to the database immediatly set charset e.g.

$link = mysql_connect('localhost', 'root', '');
$db_selected = mysql_select_db("dbname", $link);
mysql_set_charset('utf8',$link);

or OOP version

$mysqli = new mysqli('localhost', 'root', '', 'dbname', 3306);
$mysqli->set_charset('utf8');
Jump to Post

All 4 Replies

You can try this after connection made to mysql server
mysql_query("set names 'utf8'",$connection);
I hope this should work.

I hope this should work.

like this?

$sql ="UPDATE `users` SET `description` 'utf8'";
mysql_query($sql);

When connected to the database immediatly set charset e.g.

$link = mysql_connect('localhost', 'root', '');
$db_selected = mysql_select_db("dbname", $link);
mysql_set_charset('utf8',$link);

or OOP version

$mysqli = new mysqli('localhost', 'root', '', 'dbname', 3306);
$mysqli->set_charset('utf8');

When connected to the database immediatly set charset e.g.

if i do that it stores í
i wanted to store &iacute; but i guess thats even better right?

Thanksss <3

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.