From fa7c51b593b438ffef6829d9ad83b26693c0d8d4 Mon Sep 17 00:00:00 2001
From: megachriz <megachriz@654114.no-reply.drupal.org>
Date: Sat, 4 Jun 2016 12:49:30 +0200
Subject: [PATCH] Issue #2730207 by MegaChriz, twistor: Correction for the fix
 to log items that are not UTF-8-encoded.

---
 plugins/FeedsProcessor.inc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/plugins/FeedsProcessor.inc b/plugins/FeedsProcessor.inc
index 00dc6aa1..20f1250f 100644
--- a/plugins/FeedsProcessor.inc
+++ b/plugins/FeedsProcessor.inc
@@ -1264,7 +1264,10 @@ abstract class FeedsProcessor extends FeedsPlugin {
 
     foreach ($out as $key => $value) {
       if (is_string($value)) {
-        $out[$key] = truncate_utf8(utf8_encode($value), 100, FALSE, TRUE);
+        if (function_exists('mb_check_encoding') && !mb_check_encoding($value, 'UTF-8')) {
+          $value = utf8_encode($value);
+        }
+        $out[$key] = truncate_utf8($value, 100, FALSE, TRUE);
       }
     }
 
-- 
GitLab