I’m fetching the JSON timeline from twitter and parsing it through PHP.
I then want to store the text in my database.
The PHP script is in UTF8, I set the header to utf8 using this code, just in case:
header('Content-type: text/html; charset=UTF-8');
The table in the database uses utf8_general_ci, …
Not even encoding the text using utf8_encode() works.
I keep getting jumbled characters, like 'autodestruição'
Does anyone know what I’m doing wrong?
You probably need to set your database connection to UTF-8 as well.
Try sending this query to the server after establishing the connection (and before INSERTing any data):
If that doesn’t work, please show the script you are using to fetch the data.