Especially when writing PHP scripts for use on different servers, it is a very good idea to explicitly set the internal encoding somewhere on top of every document served, e.g.
mb_internal_encoding("UTF-8");
This, in combination with mysql-statement "SET NAMES 'utf8'", will save a lot of debugging trouble.
Also, use the multi-byte string functions instead of the ones you may be used to, e.g. mb_strlen() instead of strlen(), etc.