My mySQL database create shows
CREATE DATABASE `foo` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */
The mySQL field collat
The issue was resolved by adding these queries to the connection:
mysql_query("SET collation_connection = utf8_unicode_ci");
mysql_query("SET NAMES utf8;");
And THEN a call to utf8_encode()
wrapping the output.
The function call ought not be needed given all of the headers and Content-Type settings...?