fix article tags/labels not assigning properly on mysql because of the 4byte unicode workaround

This commit is contained in:
Andrew Dolgov 2015-07-06 15:32:26 +03:00
parent 6affdc59a3
commit 35c3735494
2 changed files with 8 additions and 4 deletions

View file

@ -1483,9 +1483,9 @@
$tag = preg_replace('/[\'\"\+\>\<]/', "", $tag); $tag = preg_replace('/[\'\"\+\>\<]/', "", $tag);
// $tag = str_replace('"', "", $tag); if (DB_TYPE == "mysql") {
// $tag = str_replace("+", " ", $tag); $tag = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $tag);
$tag = str_replace("technorati tag: ", "", $tag); }
return $tag; return $tag;
} }

View file

@ -761,7 +761,11 @@
// Workaround: 4-byte unicode requires utf8mb4 in MySQL. See https://tt-rss.org/forum/viewtopic.php?f=1&t=3377&p=20077#p20077 // 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") { if (DB_TYPE == "mysql") {
foreach ($article as $k => $v) { 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);
}
} }
} }