title: encoding php postgres json_encode
body: <p>I have a problem with my encoding...</p>
  
  <p>Everything is UTF-8 configured, namely my database (postgres) and my php files.</p>
  
  <p>when I execute this script:</p>
  
  <pre><code>$eleves = $serviceManager-&gt;getAll('Eleve');
  echo "&lt;pre&gt;";
  print_r($eleves);
  echo "&lt;/pre&gt;";
  </code></pre>
  
  <p>I get this:</p>
  
  <pre><code> [0] =&gt; Model_Eleve Object
      (
          [idEleve:Model_Eleve:private] =&gt; 28206
          [numeroscolaire:Model_Eleve:private] =&gt; ABE290999JOËL
          [nom:Model_Eleve:private] =&gt; Abedinpour
          [prenom:Model_Eleve:private] =&gt; Joël
          [dateNaissance:Model_Eleve:private] =&gt; 1999-09-29
          [sexe:Model_Eleve:private] =&gt; masculin
          [statusCourant:Model_Eleve:private] =&gt;
          [statusSuivant:Model_Eleve:private] =&gt;
          [adresses:Model_Eleve:private] =&gt; Array
              (
                  [0] =&gt; Model_Adresse Object
                      (
                          [idAdresse:Model_Adresse:private] =&gt; 6176
                          [rue:Model_Adresse:private] =&gt; La Delèze
                          [numero:Model_Adresse:private] =&gt; 37
                          [codePostal:Model_Adresse:private] =&gt; 1164
                          [localite:Model_Adresse:private] =&gt; Buchillon
                          [emplacement:Model_Adresse:private] =&gt;
                      )
  
              )
  </code></pre>
  
  <p>Here everything's ok. But if I want JSON:</p>
  
  <pre><code>$eleves = $serviceManager-&gt;getAll('Eleve');
  echo "&lt;pre&gt;";
  echo json_encode($eleves, JSON_PRETTY_PRINT);
  echo "&lt;/pre&gt;";
  </code></pre>
  
  <p>I get this:</p>
  
  <pre><code>{
      "nom": "Abedinpour",
      "prenom": "Jo\u00ebl",
      "adresse": [
          {
              "rue": "La Del\u00e8ze",
              "numero": "37",
              "localite": "Buchillon"
          }
      ],
      "classe": [
          "7VSG\/1"
      ]
  },
  </code></pre>
  
  <p>I have no idea why it works with array and doesn't work with json_encode... I've tried to transform everything in utf8 (with htmlentities) but it tells me that he can't convert 'ASCII'</p>
  
  <p>When I try to show the encoding of my files with this command in the terminal:</p>
  
  <pre><code>file -I myfile.php
  </code></pre>
  
  <p>it returns this:</p>
  
  <pre><code>myfile.php: text/x-php; charset=us-ascii
  </code></pre>
  
  <p>but i can't convert it to utf8:</p>
  
  <pre><code>iconv -f us-ascii -t utf-8 myfile.php &gt; myfile2.php
  file -I myfile2.php
  myfile2.php: text/x-php; charset=us-ascii
  </code></pre>
  
  <p>thanks in advance for your help</p>