title: PDO cutting off strings at a UTF-8 character
body: <p>I am using PHP 5.5 and when I attempt to insert a UTF-8 character in the MySQL database PDO cuts it off at the first non-ASCII character.</p>
  
  <p>I have set my connection to be: </p>
  
  <pre><code>(DB_TYPE.':host='.DB_HOST.';dbname='.DB_NAME.';charset=utf8', DB_USER, DB_PASS, array(PDO::ATTR_DEFAULT_FETCH_MODE =&gt; PDO::FETCH_ASSOC, PDO::ATTR_ERRMODE =&gt; PDO::ERRMODE_WARNING))
  </code></pre>
  
  <p>I have tried the SET NAMES that everyone posts, but that doesn’t work either because the problem is NOT on the MySQL side of things.</p>
  
  <p>When I do an insert through phpMyAdmin and directly from the MySQL console, it works!
  When I select the accented string with PDO, it works!</p>
  
  <p>The problem is only on <code>INSERT</code> and <code>UPDATE</code> using PDO specifically!</p>
  
  <p>Here is the SQL of the table. It is all in UTF-8 but maybe someone knows of a conflict between a setting and PDO</p>
  
  <pre><code>CREATE TABLE IF NOT EXISTS `mytable` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `id_lang` int(11) NOT NULL DEFAULT '2',
    `id_tgroup_cat` int(11) NOT NULL,
    `fieldfor` int(11) NOT NULL,
    `colors` varchar(100) NOT NULL,
    `text` text NOT NULL,
    PRIMARY KEY (`id`)
  ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=34 ;
  </code></pre>
  
  <p>I have already tried to make text a varchar field and that did not change anything.</p>
  
  <p>The actual insert in PHP:</p>
  
  <pre><code>    $query = $this-&gt;db-&gt;prepare("UPDATE mytable
                                      SET text = ?,
                                          colors = ?
                                      WHERE id = ?");
      $query-&gt;execute(array($text, $colors, $id));
  </code></pre>
  
  <p>Where <code>$text = "référence"</code> (only saves the letter R in the database but without accents it saves everything) and $colors is an empty string for test purposes and <code>$id</code> is <code>2</code>.</p>