title: GET charset with mysql PDO
body: <p>Is there a way of retrieving the current character set with PDO?
  I used to have a little test with Mysqli to check if the forced character set was set by retrieving it like so:</p>
  
  <pre><code>$mysqli-&gt;get_charset(); 
  </code></pre>
  
  <p>That doesn't work on $conn = new PDO();</p>
  
  <p>Any help is appreciated. I'm fairly new to PDO and trying to jump over from mysqli.</p>
  
  <p><em>P.s. i am aware how to set the character set, just want to test how to retrieve it.</em></p>
  
  <p>Thanks to HD answering the question I made his method static, perhaps its helpful for someone (I used some prior to 5.4 notation): </p>
  
  <pre><code> public static function getCharset(PDO $objPdo) {      
    $objCharset = $objPdo-&gt;query("SELECT COLLATION('foo')");
    $charset = $objCharset-&gt;fetch(PDO::FETCH_NUM);
    return $charset[0];
   }
  </code></pre>