How to get local characters from MySql database on remote server
<p>I'm trying to get local characters <code>č ž đ...</code> from MySql database.
On localhost the problem doesn't exists, but on remote server the local characters are missing.</p>

<p>Database and table collation is utf8_general_ci (according to one answer <a href="https://stackoverflow.com/questions/5057048/reading-signs-like-%C4%8D-%C4%87-%C4%91-%C5%A1-%C5%BE-from-mysql-database">here</a> )</p>

<p>my connection:</p>

<pre><code>try {
    $db = new PDO('mysql:host='.DBHOST.';dbname='.DBNAME.';charset=utf8_general_ci', DBUSER, DBPASS);
    $db-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

}
catch (PDOException $e) {
    echo $e-&gt;getMessage();
    exit;
}
</code></pre>

<p>here I have the error - <code>Unknown character set</code>. Writing only <code>charset=utf8</code> the error is removing, but this doesn't help about local characters.</p>

<p>edit.php</p>

<pre><code>include ("menut.php");
SET character_set_client = "utf8";  //line 12
SET character_set_results = "utf8";
SET collation_connection = "utf8_general_ci";
$stmt = $db-&gt;prepare("SELECT id, title, content FROM  $table WHERE id = :id");
$stmt-&gt;execute(array(':id' =&gt; $_GET['id']));
$row = $stmt-&gt;fetch();
</code></pre>

<p>Here I have the error - <code>Unexpected T String</code> on line 12 (marked abowe).</p>

<p>Any help.</p>