Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use utf8mb4 for the connection etc #1001

Merged
merged 3 commits into from
Apr 6, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion public_html/lists/admin/mysqli.inc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function Sql_Connect($host, $user, $password, $database)
print "Cannot connect to Database, please check your configuration";
exit;
}
mysqli_query($db, "SET NAMES 'utf8'");
mysqli_query($db, "SET NAMES 'utf8mb4'");
unset($GLOBALS['lastquery']);

return $db;
Expand Down
8 changes: 4 additions & 4 deletions public_html/lists/admin/structure.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@
'message' => array( // a message
'id' => array('integer not null primary key auto_increment', 'ID'),
'uuid' => array('varchar(36) default ""', 'UUID'),
'subject' => array("varchar(255) not null default '(no subject)'", 'subject'),
'subject' => array("varchar(255) character set utf8mb4 not null default '(no subject)'", 'subject'),
'fromfield' => array("varchar(255) not null default ''", 'from'),
'tofield' => array("varchar(255) not null default ''", 'tofield'),
'replyto' => array("varchar(255) not null default ''", 'reply-to'),
'message' => array('longtext', 'Message'),
'textmessage' => array('longtext', 'Text version of Message'),
'message' => array('longtext character set utf8mb4', 'Message'),
'textmessage' => array('longtext character set utf8mb4', 'Text version of Message'),
'footer' => array('text', 'Footer for a message'),
'entered' => array('datetime', 'Entered'),
'modified' => array('timestamp', 'Modified'),
Expand Down Expand Up @@ -155,7 +155,7 @@
'messagedata' => array(
'name' => array('varchar(100) not null', 'Name of field'),
'id' => array('integer not null', 'Message ID'),
'data' => array('longtext', 'Data'),
'data' => array('longtext character set utf8mb4', 'Data'),
'primary key' => array('(name,id)', ''),
),
'listmessage' => array( // linking messages to a list
Expand Down
8 changes: 8 additions & 0 deletions public_html/lists/admin/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,14 @@ function output($message)
Sql_Query("alter table {$GLOBALS['tables']['admin']} modify modifiedby varchar(66) default ''");
}

if (version_compare($dbversion, '3.6.15','<')) {
// support utf8mb4 for campaign subject and content
Sql_Query("alter table {$GLOBALS['tables']['message']} modify subject varchar(255) character set utf8mb4 not null default '(no subject)'");
Sql_Query("alter table {$GLOBALS['tables']['message']} modify message longtext character set utf8mb4");
Sql_Query("alter table {$GLOBALS['tables']['message']} modify textmessage longtext character set utf8mb4");
Sql_Query("alter table {$GLOBALS['tables']['messagedata']} modify data longtext character set utf8mb4");
}

//# longblobs are better at mixing character encoding. We don't know the encoding of anything we may want to store in cache
//# before converting, it's quickest to clear the cache
clearPageCache();
Expand Down
Loading