FeedsSimplePieParser.inc contains the following code:
$item['title'] = html_entity_decode(($title = $simplepie_item->get_title()) ? $title : $this->createTitle($simplepie_item->get_content()));
html_entity_decode() returns ISO-8859-1 encoded characters, which is incompatible with the encoding of the database connection, resulting in the following error:
SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xE9mand ...'
I fixed it by changing the above line of code (around line 94) to:
$item['title'] = html_entity_decode(($title = $simplepie_item->get_title()) ? $title : $this->createTitle($simplepie_item->get_content()), NULL, 'UTF-8');
Now the characters are encoded in UTF-8 and the feed items are saved properly.
Because this is a one-line change, I don't make a patch file. If the maintainers would like a patch file, I am more than happy to provide it. The file FeedsSimplePieParser.inc contains more instances of the html_entity_decode() function, those need to be changed as well I assume.
Comments
Comment #1
Jaafarx commentedHi,
I tried the code above, it didn't work. I also have
<div></div>added around some titles.Comment #2
Jaafarx commentedSolved with feeds tamper.
Comment #3
bluegeek9 commentedDrupal 7 reached end of life and the D7 version of Feeds is no longer being developed. To keep the issue queue focused on supported versions, we’re closing older D7 issues.
If you still have questions about using Feeds on Drupal 7, feel free to ask. While we won’t fix D7 bugs anymore, we’re happy to offer guidance to help you move forward. You can do so by opening (or reopening) a D7 issue, or by reaching out in the #feeds channel on Drupal Slack.
If this issue is still relevant for Drupal 10+, please open a follow-up issue or merge request with proposed changes. Contributions are always welcome!