Skip to content

Commit 67c8090

Browse files
author
Alexey Y. Fedotov aka Sloth
committed
corrected live_update encoding
1 parent 709f7d2 commit 67c8090

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

codebase/base_connector.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,9 @@ protected function end_run(){
700700
*/
701701
public function set_encoding($encoding){
702702
$this->encoding=$encoding;
703+
if ($this->live_update !== false) {
704+
$this->live_update->set_encoding($this->encoding);
705+
}
703706
}
704707

705708
/*! enable or disable dynamic loading mode
@@ -855,8 +858,9 @@ public function update($data) {
855858
url used for update notifications
856859
*/
857860
public function enable_live_update($table, $url=false){
858-
$this->live_update = new $this->live_update_data_type($this->sql, $this->config, $this->request, $table,$url, array("connector" => $this));
859-
$this->live_update->set_event($this->event,$this->names["item_class"]);
861+
$this->live_update = new $this->live_update_data_type($this->sql, $this->config, $this->request, $table,$url, array("connector" => $this));
862+
$this->live_update->set_event($this->event,$this->names["item_class"]);
863+
$this->live_update->set_encoding($this->encoding);
860864
$this->event->attach("beforeOutput", Array($this->live_update, "version_output"));
861865
$this->event->attach("beforeFiltering", Array($this->live_update, "get_updates"));
862866
$this->event->attach("beforeProcessing", Array($this->live_update, "check_collision"));

codebase/update.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,13 @@ class DataUpdate{
104104

105105
protected $table; //!< table , where actions are stored
106106
protected $url; //!< url for notification service, optional
107-
protected $sql; //!< DB wrapper object
108-
protected $config; //!< DBConfig object
109-
protected $request; //!< DBRequestConfig object
110-
protected $event;
111-
protected $item_class;
112-
protected $demu;
107+
protected $sql; //!< DB wrapper object
108+
protected $config; //!< DBConfig object
109+
protected $request; //!< DBRequestConfig object
110+
protected $encoding="utf-8";
111+
protected $event;
112+
protected $item_class;
113+
protected $demu;
113114

114115
//protected $config;//!< DataConfig instance
115116
//protected $request;//!< DataRequestConfig instance
@@ -141,6 +142,10 @@ public function set_event($master, $name){
141142
$this->event = $master;
142143
$this->item_class = $name;
143144
}
145+
146+
public function set_encoding($encoding){
147+
$this->encoding = $encoding;
148+
}
144149

145150
protected function select_update($actions_table, $join_table, $id_field_name, $version, $user) {
146151
$sql = "SELECT $join_table.*, {$actions_table}.id, {$actions_table}.dataId, {$actions_table}.type as action_table_type, {$actions_table}.user FROM {$actions_table}";
@@ -218,8 +223,8 @@ public function get_updates() {
218223
$output = $this->render_set($this->sql->select($sub_request), $this->item_class);
219224

220225
ob_clean();
221-
header("Content-type:text/xml");
222-
226+
header("Content-type:text/xml; charset=".$this->encoding;);
227+
223228
echo $this->updates_start();
224229
echo $this->get_version();
225230
echo $output;

0 commit comments

Comments
 (0)