note 89593 deleted from ref.pdo-mysql.connection by peehaa
| From: | peehaa@php.net | Date: | Tue, 21 Mar 2017 08:44:06 +0000 |
| Subject: | note 89593 deleted from ref.pdo-mysql.connection by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-208935@lists.php.net to get a copy of this message | ||
Note Submitter: rustamabd at gmail dot com
----
Even though pdo_mysql accepts an additional "charset" parameter in the DSN (see
mysql_driver.c:442), as of PHP 5.2.9 it does not do anything with it.
A possible workaround to set the charset to UTF-8, for example, could be:
<?php
$dbh = new PDO("mysql:$connstr", $user, $password);
$dbh -> exec("set names utf8");
?>