summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2015-06-16 08:17:49 +0300
committerAndrew Dolgov <[email protected]>2015-06-16 08:17:49 +0300
commit35c12dc40a4efb2b3f1ca8a8f822819ce1d34b8a (patch)
tree5c2fa5924a13f6247693a1b2795951af6f391d82
parent5914f319814ccb65a2d3311f77033ecd534dd4b0 (diff)
add workaround for mysql only accepting subset of unicode characters
-rw-r--r--include/rssfuncs.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/rssfuncs.php b/include/rssfuncs.php
index cc8a8e3f0..17233914e 100644
--- a/include/rssfuncs.php
+++ b/include/rssfuncs.php
@@ -736,6 +736,13 @@
_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"]);