]> git.wh0rd.org - tt-rss.git/commitdiff
add workaround for mysql only accepting subset of unicode characters
authorAndrew Dolgov <noreply@fakecake.org>
Tue, 16 Jun 2015 05:17:49 +0000 (08:17 +0300)
committerAndrew Dolgov <noreply@fakecake.org>
Tue, 16 Jun 2015 05:17:49 +0000 (08:17 +0300)
include/rssfuncs.php

index cc8a8e3f0b331fd6cbb3025ad909ecc0ea68cba3..17233914ee1b096ff7d7a9d21aa3028c4efce303 100644 (file)
 
                                _debug("plugin data: $entry_plugin_data", $debug_enabled);
 
+                               // Workaround: 4-byte unicode requires utf8mb4 in MySQL. See https://tt-rss.org/forum/viewtopic.php?f=1&t=3377&p=20077#p20077
+                               if (DB_TYPE == "mysql") {
+                                       foreach ($article as $k => $v) {
+                                               $article[$k] = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $v);
+                                       }
+                               }
+
                                $entry_tags = $article["tags"];
                                $entry_guid = db_escape_string($entry_guid);
                                $entry_title = db_escape_string($article["title"]);