UFT-8 on a website based on mySQL and PHP

I spent quite some time today trying to get the text on a website with Bulgarian characters to show properly. The text is coming out of a MYSQL 5.0 database, configured to use utf8_general_ci and the website is generated by PHP 5.2.5.
I knew I had to use
meta equiv=”Content-Type” content=”text/html; charset=utf-8″
to display the Bulgarian characters properly (like Велико Търново) and that worked fine for static text, but I got ???????? when using the text from the database.
I tried all sorts of things, and visited various websites with proposed solution, but finally I got it working by one simple setting, explained by this website. I needed to include
mysql_query(‘SET NAMES utf8’);
when connecting to the database. That solved the issue.