I want to set UTF8 for my PDO object. This class works correctly with MySQL. I can not find the analogue array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES UTF8") for PgSQL, and I can not work with Cyrillic characters.
class oop{ private $host="localhost"; private $user="xxxx"; private $db="xxxx"; private $pass="111111"; private $conn; public function __construct(){ $this->conn = new PDO("pgsql:host=".$this->host.";dbname=".$this->db,$this->user,$this->pass,array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES UTF8") ); }
source share