diff --git a/includes/settings.php b/includes/settings.php index 9be6edc..371a85e 100644 --- a/includes/settings.php +++ b/includes/settings.php @@ -47,13 +47,19 @@ final class Settings { } if ($connect) { - $dsn = "$driver:dbname=$database;host=$host;port=$port;charset=utf8"; + $dsn = "$driver:dbname=$database;host=$host;port=$port"; + if ($driver === 'mysql') { + $dsn .= ';charset=utf8'; + } try { $this->conn = new PDO($dsn, $username, $password); } catch (PDOException $e) { echo 'Connection failed: ' . $e->getMessage(); } + if ($driver === 'pgsql') { + $this->conn->query("SET NAMES 'UTF8';"); + } } } }