0
0
mirror of https://github.com/postfixadmin/postfixadmin.git synced 2024-09-19 19:22:14 +02:00

UTF8 is no real UTF8 in MySQL, on needs to use utf8mb4

This allows to use emojis in vacation mails.

Signed-off-by: Sven Strickroth <email@cs-ware.de>
This commit is contained in:
Sven Strickroth 2021-05-07 17:55:18 +02:00
parent 269515b1ad
commit 3cde7af742
2 changed files with 5 additions and 5 deletions

View File

@ -208,7 +208,7 @@ if (!$dbh) {
my $db_true; # MySQL and PgSQL use different values for TRUE, and unicode support...
if ($db_type eq 'mysql') {
$dbh->do('SET CHARACTER SET utf8;');
$dbh->do('SET CHARACTER SET utf8mb4;');
$db_true = '1';
} else { # Pg
$dbh->do("SET CLIENT_ENCODING TO 'UTF8'");

View File

@ -1626,9 +1626,9 @@ function db_connection_string()
$database_name = Config::read_string('database_name');
if ($socket) {
$dsn = "mysql:unix_socket={$socket};dbname={$database_name};charset=UTF8";
$dsn = "mysql:unix_socket={$socket};dbname={$database_name};charset=utf8mb4";
} else {
$dsn = "mysql:host={$CONF['database_host']};dbname={$database_name};charset=UTF8";
$dsn = "mysql:host={$CONF['database_host']};dbname={$database_name};charset=utf8mb4";
}
} elseif (db_sqlite()) {
$db = $CONF['database_name'];
@ -1699,8 +1699,8 @@ function db_connect()
$options[PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT] = (bool)$verify;
}
$queries[] = 'SET CHARACTER SET utf8';
$queries[] = "SET COLLATION_CONNECTION='utf8_general_ci'";
$queries[] = 'SET CHARACTER SET utf8mb4';
$queries[] = "SET COLLATION_CONNECTION='utf8mb4_general_ci'";
} elseif (db_sqlite()) {
$db = $CONF['database_name'];