0

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

3
Contributors
4
Replies
22
Views
3 Years
Discussion Span
Last Post by centenond
0

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

0

I hope this should work.

like this?

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

Edited by centenond

1

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');

Edited by AndrisP

0

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.