Hi!
I use PHP Connector 2.2.0 from GitHub.
I had some trouble with data from database which cp1251 codepage encoded. Data isn’t updated in Grid. For solve this issue i added some string into two files of PHP Connector (base_connector.php and updates.php)
In base_connector.php for method enable_live_update() in Connector class i added set_encoding()
public function enable_live_update($table, $url=false){
$this->live_update = new DataUpdate($this->sql, $this->config, $this->request, $table,$url);
$this->live_update->set_event($this->event,$this->names["item_class"]);
$this->live_update->set_encoding($this->encoding);
$this->event->attach("beforeOutput", Array($this->live_update, "version_output"));
$this->event->attach("beforeFiltering", Array($this->live_update, "get_updates"));
$this->event->attach("beforeProcessing", Array($this->live_update, "check_collision"));
$this->event->attach("afterProcessing", Array($this->live_update, "log_operations"));
}
In update.php i added protected property $encoding for DataUpdate class
[code]class DataUpdate{
protected $table; //!< table , where actions are stored
protected $url; //!< url for notification service, optional
protected $sql; //!< DB wrapper object
protected $config; //!< DBConfig object
protected $request; //!< DBRequestConfig object
protected $encoding;
protected $event;
[/code]
also for this class i added method set_encoding()
public function set_encoding($encoding){
$this->encoding = $encoding;
}
and finally i replaced this section in get_update() method
[code] ob_clean();
header(“Content-type:text/xml”);
echo $this->updates_start();
[/code]
on this
[code] ob_clean();
$header = “Content-type:text/xml”;
if ( $this->encoding != “”) {
$header .= “; charset=”.$this->encoding;
}
header($header);
echo $this->updates_start();
[/code]
Now it works fine.