So I've started making a web application and I thought it would be nice to also have a the functionality in it to handle 'special' characters.
So I have looked around to fix this and have tried multiple things to change charset to utf8.
So I have changed my table using ALTER TABLE mytable CONVERT TO CHARACTER SET utf8
This works IF I run the SQL query in the database. But when I run my query using PHP code, it shows as this:
捦べ 裃壎
My PDO connection is like this:
$this->dbopen = new PDO('mysql:host=' . $this->dbhost . ';dbname='. $this->dbname . '', $this->dbuser, $this->dbpass, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8") );
I've also tried:
$this->dbopen = new PDO('mysql:host=' . $this->dbhost . ';dbname='. $this->dbname . ';charset=utf8', $this->dbuser, $this->dbpass);
My query goes as follows:
$this->query = 'INSERT INTO titles (Title, Description, Image, SoundFile) VALUES (' . $this->title . ', ' . $this->description . ', ' . $this->image . ', ' . $this->sound . ')';
Yet it still shows it like: 捦べ 裃壎 ず愦ひ嶥鄥 ぐい馯キャば
I have no clue how to change this. Any other suggestions?