I'm having a problem in inserting data in php. It sometimes create a character like a black diamond with a question mark.
do you have any idea how can i fix it?
I'm having a problem in inserting data in php. It sometimes create a character like a black diamond with a question mark.
do you have any idea how can i fix it?
You should have the same encoding everywhere and define it.
Define the charset like this;
<meta charset="UTF-8" />
and in the header;
header('Content-Type: text/html; charset=utf-8');
You can also write your characters with html characters, however it is always good to define the charset.
If you have ISO-8859-1
(latin1
) data in your database, and the rest of the site in UTF-8
. Then define the charset-tag as above and use the function utf8_encode() to give the string a properly encoding. There is also a reverse function called utf8_decode()