From c185685f2d7edd63f41d8fc59ca198266be6605c Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 9 Feb 2022 08:57:27 +0000 Subject: pdo: add the charset to the connection string --- include/dba/dba_pdo.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include/dba') diff --git a/include/dba/dba_pdo.php b/include/dba/dba_pdo.php index 49f741601..2137ca0cc 100644 --- a/include/dba/dba_pdo.php +++ b/include/dba/dba_pdo.php @@ -27,6 +27,13 @@ class dba_pdo extends dba_driver { $dsn .= ';dbname=' . $db; + if ($this->driver_dbtype === 'mysql') { + $dsn .= ';charset=utf8mb4'; + } + else { + $dsn .= ";options='--client_encoding=UTF8'"; + } + try { $this->db = new PDO($dsn,$user,$pass); $this->db->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION); -- cgit v1.2.3