diff --git a/src/Db/Core.php b/src/Db/Core.php index af42bf0..7cfd503 100644 --- a/src/Db/Core.php +++ b/src/Db/Core.php @@ -204,7 +204,11 @@ protected function dsn(): string $dsn .= ';port=' . $this->config('port'); } if ($this->config('charset')) { - $dsn .= ';charset=' . $this->config('charset'); + if($dbtype === 'pgsql') { + $dsn .= ';options=\'--client_encoding='.$this->config('charset').'\''; + } else { + $dsn .= ';charset=' . $this->config('charset'); + } } if ($this->config('unixSocket')) { $dsn .= ';unix_socket=' . $this->config('unixSocket');