Possible Duplicate:
UTF-8 all the way through
I am scraping data with curl from a web which have word Café. It looks fine when i echo it but after insert in mysql data base it become Café
How to handle it.
Possible Duplicate:
UTF-8 all the way through
I am scraping data with curl from a web which have word Café. It looks fine when i echo it but after insert in mysql data base it become Café
How to handle it.
Runtime configuration:
mb_internal_encoding("UTF-8");
And set the file encoding in you text editor to UTF8 without BOM (for example in Notepad++: Encoding menu, then Convert to UTF8 without BOM)
Set all encoding and collation to UTF8 in you editor/designer (PhpMyAdmin).
I don't know what driver are you using, for mysqli (and for mysql but please don't use that):
"SET CHARACTER SET 'utf8'"
'SET NAMES utf8'
PDO has it's own configuration for this, see php.net.
Set it with a header call:
header('Content-Type: text/html; charset=utf-8');
There are several things you neecd to check. First check that the encoding on the table you are using is capable of supporting any special characters you need. Use something like utf-unicode-ci
. I would suggest reading up a little on these.
There are several utf8 character encodings, they are optimized for searching in different languages, hence their names. For more on unicode charsets read here
You must also make sure your connection knows which character encoding you are using in php.