Well, I got a MySQL db, encoded as utf8_unicode_ci, and it runs like a charm with the current application (written in Code Igniter)
Now, I’m developing a new PHP app, and when I try to recover the data, several characters are unreadable – chars appears ok in the DB with phpMyAdmin, but when I try to put it up in a webpage, it became like “ROLA �60”.
These characters are spanish letters, such as ñ, á, Ó… or ascii codes like €, Ø…
Where’s the problem? I’ve set the page as meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″, I’ve tried the mysql_set_charset() function, and still nothing.
Any experience with this kind of problems?
I have noticed this exact problem in my database driven applications, and it took me a long time to work it out!
The problem occurs because there are at least three places in your application that need their character sets defining, and they must all be the same character set (and that character set must be able to handle the characters you are handling).
The question mark symbol and it’s variations occurs when the browser doesn’t understand what character it is being passed.
Make sure your character sets match in the following places:
Judging from your post, it looks like your PHP configuration might be set to be using a different default_charset. This means that your database will be storing the characters fine, and will be sendign the characters fine to your script, but the PHP script itself will not know what to do with the character, and thus outputs to the browser as the annoying question mark symbol.
Try changing the php.ini value to the same charset, and you may be surprised to see the characters displaying fine! If you don’t have access to php.ini, you can change the value with the following function:
Hope this helps.