aboutsummaryrefslogtreecommitdiffstats
path: root/include/dba
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2022-02-09 08:57:27 +0000
committerMario <mario@mariovavti.com>2022-02-09 08:57:27 +0000
commitc185685f2d7edd63f41d8fc59ca198266be6605c (patch)
treef197a5be754b6ae181b7202f5de5d7876684f272 /include/dba
parentdaee5b34775ed601e1a06b989ffe929ec8f4c5a9 (diff)
downloadvolse-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/dba')
-rw-r--r--include/dba/dba_pdo.php7
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);