From f4fbe89e0e70a540a2f4112e4c82c99138bc7c8e Mon Sep 17 00:00:00 2001 From: Adam Harvey Date: Tue, 14 Jun 2011 15:08:42 +0000 Subject: [PATCH] Per a suggestion from Philip on IRC, show how to work around the charset DSN parameter being ignored with pdo_mysql before PHP 5.3.6, based on a user note by Davy Defaud. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@312154 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/pdo_mysql/reference.xml | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/reference/pdo_mysql/reference.xml b/reference/pdo_mysql/reference.xml index 2925b6082f..657e90c707 100644 --- a/reference/pdo_mysql/reference.xml +++ b/reference/pdo_mysql/reference.xml @@ -91,7 +91,34 @@ charset - The character set (since PHP 5.3.6). + The character set. + + + Prior to PHP 5.3.6, this element was silently ignored. The same + behaviour can be replicated with the + PDO::MYSQL_ATTR_INIT_COMMAND driver option, as + the following example shows. + + + + + Setting the connection character set to UTF-8 prior to PHP 5.3.6 + + + 'SET NAMES utf8', +); + +$dbh = new PDO($dsn, $username, $password, $options); +?> +]]> + +