Encoding problem: ยฃ pound symbol denoted as <?> Symbol
My database field is set to utf8_general_ci, and the encoding of my sites is set to utf8.
The ยฃ symbol appears as a black diamond with a question mark across the center.
I tried changing it to £ in the database, and he just pulled & pound;
I tried replacing the string:
$row['Information'] = str_replace("ยฃ", "£", $row['Information']); Nothing works, any ideas?
I tried changing it to
£in the database
not to do. The database should contain the source text, not HTML-encoded content. The time for HTML coding (using htmlspecialchars() ) is when you paste some raw text into HTML at the output template stage, and not earlier. Even if you have it at work, you would only set one character; the remaining 107025 characters other than ASCII will still be broken.
Clearly, there is a mismatch in the encodings; you must make sure that you use the same encoding (preferably UTF-8) everywhere, in particular:
- the encoding into which you saved the PHP file, if it contains any characters other than ASCII;
- the encoding declared on the output page (by Content-Type
<meta>orheader(), both are desirable; if you use only<meta>to install it and the server is configured incorrectly, it can set its owncharsetredefinition of your ); - column encoding in the database (each column has its own sorting, so just setting it on the table is inefficient);
- The encoding used by PHP to communicate with MySQL. This needs to be set using
mysql_set_charset.
Unfortunately, none of these settings are set to UTF-8 by default.