title: Russian Cyrillic text into database
body: <p><strong>EDIT/UPDATE TO CODE:</strong><br>
  this fixed my problem.</p>
  
  <pre><code>$con = new PDO("mysql:host=$hostname;dbname=XXXXX;charset=utf8", $dbusername, $dbpassword, array(PDO::ATTR_ERRMODE =&gt; PDO::ERRMODE_EXCEPTION,PDO::MYSQL_ATTR_INIT_COMMAND =&gt; "SET NAMES utf8")); 
  </code></pre>
  
  <p>I am trying to enter some Cyrillic text into my database. The PHP script connects ok and adds the data to the database. The problem is, that when ever the form submits Cyrillic text in enters the Cyrillic characters it in the database like this "Ñ€Ñ‚Ñ‹ Ð´Ð»Ñ Ð¿Ð»Ð°Ð²Ð°Ð½Ð¸Ñ" </p>
  
  <p>Any help would be great, thanks.</p>
  
  <p>The database collation is set to "utf8_general_ci". The php file is saved as "uft8"(hostgator host-if that helps). </p>
  
  <p>I have this at the top of the page.</p>
  
  <pre><code>&lt;?php header("Content-Type: text/html; charset=utf-8"); ?&gt;
  </code></pre>
  
  <p>I have added this to the header of my file:</p>
  
  <pre><code>&lt;meta http-equiv="Content-Type" content="text/html;charset=UTF-8"&gt;
  </code></pre>
  
  <p>The connection to the database is like this:</p>
  
  <pre><code>$con = new PDO("mysql:host=$hostname;dbname=XXXXX;charset=utf8", $dbusername, $dbpassword); 
  </code></pre>
  
  <p>Example of the form:</p>
  
  <pre><code>&lt;form name="form" id="form" action="/form.php" method="post" accept-charset="utf-8"&gt;
  &lt;input type="hidden" name="foo" id="foo1" value="&lt;?php echo $foo1; ?&gt;"&gt;&lt;?php echo $foo1; ?&gt;   
  &lt;input type="hidden" name="bar" id="bar1" value="&lt;?php echo $bar1; ?&gt;"&gt;&lt;?php echo $bar1; ?&gt;  
  &lt;input type="submit" id="submit" value="submit"/&gt;
  </code></pre>
  
  <p><em>*</em>*the php echos the Russian text properly on the page.
  <br></p>
  
  <p>Example of my PHP SQL insert:</p>
  
  <pre><code> $sql = "INSERT INTO foobar (foo1,bar1) VALUES (:foo1,:bar1)";
     $q = $con-&gt;prepare($sql);
     $q-&gt;execute(array(':foo1'=&gt;$foo1, 
               ':bar1'=&gt;$bar1));
  </code></pre>