0

I am running MariaDB on CentOS 7 with PHP 5.6. Here is my connection string:

try {
   $connStr = 'mysql:host=server;dbname=mysql';
   $pdo = new PDO($connStr, 'user', 'passwd');
   $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
   $pdo->exec('SET NAMES utf8');
catch(PDOException $err) {
   var_dump($err->getMessage());
   die();
}

Everything works fine, there is no encoding issues except with PDO errors which raise some weirds characaters:

MUH��/NU(~�03��D!71G� ����J����̜��*���+S��+S��N|5

How can I manage that?

Jibeji
  • 453
  • 4
  • 14
  • Look for "black diamond" in [_here_](http://stackoverflow.com/questions/38363566/trouble-with-utf8-characters-what-i-see-is-not-what-i-stored) – Rick James May 05 '17 at 19:56
  • The problem is that it happens only with SQL error messages. Data are corectly handled – Jibeji May 12 '17 at 10:03

1 Answers1

0

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> near start of html page

Rick James
  • 135,179
  • 13
  • 127
  • 222