I thought I understood how charset worked but obviously not yet.
Using eclipse I create a new PHP project. I add an index.php file (very simple) :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
  <head>
<meta http-equiv="Content-Type" content="text/html charset=utf-8" />
  </head>
  <body>
    <?php
      try {
    $dbh = new PDO('mysql:host=localhost;dbname=symfony', 'root', '');
    foreach($dbh->query('SELECT * from product') as $row) {
    print_r($row['description'] ."</br/>");
    }
    $dbh = null;
      } catch (PDOException $e) {
    print "Erreur !: " . $e->getMessage() . "<br/>";
    die();
      }
   ?>
  </body>
</html>
the field 'description' is utf8_general
my database is utf8_general
I can read in phpMyAdmin that my database server charser UTF-8 Unicode (utf8)
I add the directive 'AddDefaultCharset utf-8' in the Apache config file
the charset in php file is utf-8
Anyway there is a problem with the accentuated letters.
To display them properly I can :
- change Apache default charset : AddDefaultCharset iso-8851-1
OR
- use the utf8_encode PHP function
My question is : considering that everything is UTF-8, when are my strings formatted in iso-8851-1 along the line of execution ?
 
     
     
    