PDO Query Turkish Character Not Working

时间:2018-04-20 01:00:48

标签: php pdo

I read the solutions written on the site. Single continuing my problem.

I have a query on the data coming from the URL.

Listele/Arama/Satilik/Konut <--- Working

it returns the desired results.

Listele/Arama/Satilik/Yazlık <--- Not Working

returning empty.

My connect the code is as follows:

class Model extends \PDO{
   public function __construct() {
        parent::__construct ('mysql:host=localhost;dbname=example;charset=utf8;port='.Config::Get('Database/Port'), 
                             Config::Get('Database/Username'),
                             Config::Get('Database/Password'),
                             [ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'" ]);

    }
}

Also at the beginning of my page.

header('Content-Type: text/html; charset=utf-8');

and mysql character set is utf8_turkish_ci.

Best Regards.

0 个答案:

没有答案