]> git.wh0rd.org Git - tt-rss.git/commitdiff
fix article tags/labels not assigning properly on mysql because of the 4byte unicode...
authorAndrew Dolgov <noreply@fakecake.org>
Mon, 6 Jul 2015 12:32:26 +0000 (15:32 +0300)
committerAndrew Dolgov <noreply@fakecake.org>
Mon, 6 Jul 2015 12:32:26 +0000 (15:32 +0300)
include/functions2.php
include/rssfuncs.php

index e212609db2546665192a39b29ae19a23541f65e4..1936d146d081813740bc43f9841422a1cb3f8378 100644 (file)
 
                $tag = preg_replace('/[\'\"\+\>\<]/', "", $tag);
 
-//             $tag = str_replace('"', "", $tag);
-//             $tag = str_replace("+", " ", $tag);
-               $tag = str_replace("technorati tag: ", "", $tag);
+               if (DB_TYPE == "mysql") {
+                       $tag = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $tag);
+               }
 
                return $tag;
        }
index 8797ee523077b57c1ead9652ce27eafd23a5fbba..6eb4e6d98017925779edf56d9a792d90201adf5c 100644 (file)
                                // 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);
+
+                                               // i guess we'll have to take the risk of 4byte unicode labels & tags here
+                                               if (!is_array($article[$k])) {
+                                                       $article[$k] = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $v);
+                                               }
                                        }
                                }