Only strip utf8mb4 if mysql_charset != utf8mb4

If a user has fixed their database properly utf8mb4 works just fine allowing emoji and other 4 byte unicode characters to work.
This commit is contained in:
BtbN 2018-08-04 13:07:32 +00:00
parent c925f4e3fd
commit 2b8afd4942
1 changed files with 2 additions and 2 deletions

View File

@ -767,7 +767,7 @@ class RSSUtils {
_debug("plugin data: $entry_plugin_data", $debug_enabled); _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 // 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" && MYSQL_CHARSET != "UTF8MB4") {
foreach ($article as $k => $v) { foreach ($article as $k => $v) {
// i guess we'll have to take the risk of 4byte unicode labels & tags here // i guess we'll have to take the risk of 4byte unicode labels & tags here
if (is_string($article[$k])) { if (is_string($article[$k])) {
@ -1053,7 +1053,7 @@ class RSSUtils {
$e->type, $e->length, $e->title, $e->width, $e->height); $e->type, $e->length, $e->title, $e->width, $e->height);
// Yet another episode of "mysql utf8_general_ci is gimped" // Yet another episode of "mysql utf8_general_ci is gimped"
if (DB_TYPE == "mysql") { if (DB_TYPE == "mysql" && MYSQL_CHARSET != "UTF8MB4") {
for ($i = 0; $i < count($e_item); $i++) { for ($i = 0; $i < count($e_item); $i++) {
if (is_string($e_item[$i])) { if (is_string($e_item[$i])) {
$e_item[$i] = RSSUtils::strip_utf8mb4($e_item[$i]); $e_item[$i] = RSSUtils::strip_utf8mb4($e_item[$i]);