diff options
author | Mario <mario@mariovavti.com> | 2022-02-09 08:57:27 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2022-02-09 08:57:27 +0000 |
commit | c185685f2d7edd63f41d8fc59ca198266be6605c (patch) | |
tree | f197a5be754b6ae181b7202f5de5d7876684f272 /include | |
parent | daee5b34775ed601e1a06b989ffe929ec8f4c5a9 (diff) | |
download | volse-hubzilla-c185685f2d7edd63f41d8fc59ca198266be6605c.tar.gz volse-hubzilla-c185685f2d7edd63f41d8fc59ca198266be6605c.tar.bz2 volse-hubzilla-c185685f2d7edd63f41d8fc59ca198266be6605c.zip |
pdo: add the charset to the connection string
Diffstat (limited to 'include')
-rw-r--r-- | include/dba/dba_pdo.php | 7 |
1 files changed, 7 insertions, 0 deletions
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); |