My charset in the database is set to utf8_unicode_ci, all files encoded in UTF8 (without BOM).
Here is my php code:
<?php
require_once("./includes/config.php");
$article = new Article();
$fields = array(
'status' => '0',
'title' => 'מכבי ת"א אלופת אירופה בפעם ה-9',
'shorttitle' => 'מכבי ת"א אלופת אירופה',
'priority' => '1',
'type' => '1',
'category' => '2',
'template' => '68',
'author' => '1',
'date' => date("Y-m-d H:i"),
'lastupdate' => date("Y-m-d H:i"),
'preview' => 'בלה בלה בלה',
'content' => 'עוד קצת בלה בלה בלה',
'tags' => 'מכבי ת"א,יורוליג,אליפות אירופה',
'comments' => '1'
);
$article->set($fields);
$article->save();
for some reason, the Hebrew characters appear like this in phpmyadmin:
מכבי ת"× ×לופת ×ירופה ×‘×¤×¢× ×”-9
Database connection code:
<?php
final class Database
{
protected $fields;
protected $con;
public function __construct($host = "", $name = "", $username = "", $password = "")
{
if ($host == "")
{
global $config;
$this->fields = array(
'dbhost' => $config['Database']['host'],
'dbname' => $config['Database']['name'],
'dbusername' => $config['Database']['username'],
'dbpassword' => $config['Database']['password']
);
$this->con = new mysqli($this->fields['dbhost'], $this->fields['dbusername'], $this->fields['dbpassword'], $this->fields['dbname']);
if ($this->con->connect_errno > 0)
die("<b>Database connection error:</b> ".$this->con->connect_error);
}
else
{
$this->con = new mysqli($host, $username, $password, $name);
if ($this->con->connect_errno > 0)
die("<b>Database connection error:</b> ".$this->con->connect_error);
}
}
Any ideas why?