Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Zend\Db PDO adapter ignoring charset #4662

Closed
Thinkscape opened this issue Jun 14, 2013 · 7 comments
Closed

Zend\Db PDO adapter ignoring charset #4662

Thinkscape opened this issue Jun 14, 2013 · 7 comments
Assignees
Labels
Milestone

Comments

@Thinkscape
Copy link
Member

Pdo Adapter (Pdo\Connection) ignores charset config option.

Beware: PDO has a buggy implementation of charset= parameter in DSN... better use this workaround to fix Adapter charset support:

$connect = new PDO(
  "mysql:host=$host;dbname=$db", 
  $user, 
  $pass, 
  array(
    PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"
  )
);

source: http://stackoverflow.com/a/7325424/181664

@froschdesign
Copy link
Member

Notice:

charset
Prior to PHP 5.3.6, this element was silently ignored. The same behaviour can be partly replicated with the PDO::MYSQL_ATTR_INIT_COMMAND driver option…

http://php.net/manual/en/ref.pdo-mysql.connection.php

@desem
Copy link

desem commented Jun 15, 2013

'driver_options' => array(
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES 'UTF8',
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET CHARACTER SET 'UTF8',
),

@Thinkscape
Copy link
Member Author

Exactly why it should fly into Zend\Db

@dlu-gs
Copy link
Contributor

dlu-gs commented Aug 16, 2013

I've sent a PR #4973

@Thinkscape
Copy link
Member Author

@dlu-gs 👍

@samsonasik
Copy link
Contributor

@Thinkscape #4973 merged, so should it closed ?

@ralphschindler
Copy link
Member

Fixed (seemingly) in #4973

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants