title: How to set charset to UTF8 in pdo oracle(oci)
body: <p>Here is my php codes</p>
  
  <pre><code>$tns = "
   (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
        )
          (CONNECT_DATA =
            (SERVICE_NAME = myservice)
        )
   )";
  $conn = new PDO("oci:dbname=" . $tns, 'user', 'pass');
  </code></pre>
  
  <p>When I try to set the charset to UTF8 like this:</p>
  
  <pre><code>$conn = new PDO("oci:dbname=" . $tns . ";charset=UTF8", 'user', 'pass');
  </code></pre>
  
  <p>will get:
  <code>ERROR: SQLSTATE[HY000]: OCINlsCharSetNameToId: unknown character set name  (/app/software/php-5.6.30/ext/pdo_oci/oci_driver.c:610)pdo is NULL</code></p>
  
  <p>I have already set the NLS_LANG to <code>AMERICAN_AMERICA.UTF8</code>, but looks like my host machine need to restart, I can NOT do it now. </p>
  
  <p>So, what should I do can change the charset to utf8 with pdo/oci connected to oracle database??</p>
  
  <p>And I want:</p>
  
  <ol>
  <li><strong>NOT</strong> modify the charset in oracle databse</li>
  <li><strong>ONLY</strong> use pdo, not oci_connect  </li>
  <li><strong>NOT</strong> restart my host machine</li>
  </ol>