I clear the list of RSS feeds using cURL and then I read and parse the RSS data using SimpleXML. Then the sorted data is inserted into the mySQL database.
However, as a notification at http://dansays.co.uk/research/MNA/rss.php I am having several problems with the incorrect display of characters.
Examples:
âGuitar Hero: Van Halenâ Trailer And Tracklist Available
NV 10/10/09 â€" Salt Lake City, UT 10/11/09 â€" Denver, CO 10/13/09 â€"
I tried using htmlentities and htmlspecialchars for the data before inserting them into the database, but it doesn't seem to help solve the problem.
How can I solve this problem that I have?
Thanks for any advice.
Update
I tried what Greg suggested, and the problem is still here ...
Here is the code I used for SET NAMES in PDO:
$dbh = new PDO($dbstring, $username, $password);
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$dbh->query('SET NAMES "utf8"');
simplexml, , , - cURL...
cURL:
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_ENCODING, 'UTF-8');
$data = curl_exec($ch);
curl_close($ch);
$doc = new SimpleXmlElement($data, LIBXML_NOCDATA);
RSS/HTML "UTF-8", . , , char . PHP6!