I've been programming a class that inserts into, updates and deletes from tables in my database. My problem is that, when I attempt to insert something with Icelandic characters (covered in UTF-8) - it isn't inserted into the database. I then proceeded to attempt to use the same query on the database level, and that worked just fine. But for some reason, when I'm trying to send it through with PDO, it doesn't work. So what I assume is going on here is a charset problem, somewhere, and at first I tried this:
$this->dbh = new PDO('mysql:host=localhost;dbname=gluteusbase;charset=UTF-8', 'root', 'password (this is fine)');
The part I added was charset=UTF-8. This didn't change anything, things with Icelandic characters still don't get inserted. I then found someone saying that it should be charset=utf8. I tried this as well with no luck. However it didn't give me an error.
After which I tried this:
$this->dbh = new PDO('mysql:host=localhost;dbname=gluteusbase;charset=UTF-8', 'root', 'VEF2A3U', array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
Still no luck. Does anyone have an idea of what I may be doing wrong?

New Topic/Question
Reply



MultiQuote






|