utf-8

Fixing UTF-8 encoding problems on MySQL queries with PHP

Posted by on Aug 24, 2010 in Backend | 4 comments

It happened to me a lot of times, I had my connection set to UTF-8, my database was UTF-8, even my tables and every single field, however, for some reason, the information I updated in phpMyAdmin wasn’t being displayed correctly on my website and the information edited on my website wasn’t being displayed correctly in phpMyAdmin.

You know all those weird characters, those that very often come up when you write accented letters or words in another language like Portuguese or Spanish? That’s what I am talking about.

Here is the solution. A single line that can save you hours of research.