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

Jaafarx’s picture

Hi,

I tried the code above, it didn't work. I also have <div></div> added around some titles.

Jaafarx’s picture

Solved with feeds tamper.

bluegeek9’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

Drupal 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!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.