Skip to content

Commit e65b04a

Browse files
committed
Fixed general utf8 encoding problems when data is passed from frontend to server, this fixes also bug FS#1065 - Special characters in autoresponder subject may break the autoresponder
1 parent 6dc3004 commit e65b04a

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

interface/lib/classes/db_mysql.inc.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ public function connect()
7676
return false;
7777
}
7878
$this->queryId = @mysql_query('SET NAMES '.$this->dbCharset, $this->linkId);
79+
$this->queryId = @mysql_query("SET character_set_results = '".$this->dbCharset."', character_set_client = '".$this->dbCharset."', character_set_connection = '".$this->dbCharset."', character_set_database = '".$this->dbCharset."', character_set_server = '".$this->dbCharset."'", $this->linkId);
7980
}
8081
return true;
8182
}

server/lib/classes/db_mysql.inc.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ function connect()
8080
$this->updateError('DB::connect()-> mysql_connect');
8181
return false;
8282
}
83+
$this->queryId = @mysql_query('SET NAMES '.$this->dbCharset, $this->linkId);
84+
$this->queryId = @mysql_query("SET character_set_results = '".$this->dbCharset."', character_set_client = '".$this->dbCharset."', character_set_connection = '".$this->dbCharset."', character_set_database = '".$this->dbCharset."', character_set_server = '".$this->dbCharset."'", $this->linkId);
8385
}
8486
return true;
8587
}

server/lib/classes/modules.inc.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,18 @@ function processDatalog() {
9494
foreach($records as $d) {
9595

9696
//** encode data to utf-8 and unserialize it
97-
if(!$data = unserialize(utf8_encode(stripslashes($d["data"])))) {
98-
$data = unserialize(utf8_encode($d["data"]));
97+
if(!$data = unserialize(stripslashes($d["data"]))) {
98+
$data = unserialize($d["data"]);
9999
}
100100
//** Decode data back to locale
101+
/*
101102
foreach($data['old'] as $key => $val) {
102103
$data['old'][$key] = utf8_decode($val);
103104
}
104105
foreach($data['new'] as $key => $val) {
105106
$data['new'][$key] = utf8_decode($val);
106107
}
108+
*/
107109

108110
$replication_error = false;
109111

@@ -188,16 +190,18 @@ function processDatalog() {
188190
foreach($records as $d) {
189191

190192
//** encode data to utf-8 to be able to unserialize it and then unserialize it
191-
if(!$data = unserialize(utf8_encode(stripslashes($d["data"])))) {
192-
$data = unserialize(utf8_encode($d["data"]));
193+
if(!$data = unserialize(stripslashes($d["data"]))) {
194+
$data = unserialize($d["data"]);
193195
}
194196
//** decode data back to current locale
197+
/*
195198
foreach($data['old'] as $key => $val) {
196199
$data['old'][$key] = utf8_decode($val);
197200
}
198201
foreach($data['new'] as $key => $val) {
199202
$data['new'][$key] = utf8_decode($val);
200203
}
204+
*/
201205

202206
$this->current_datalog_id = $d["datalog_id"];
203207
$this->raiseTableHook($d["dbtable"],$d["action"],$data);

0 commit comments

Comments
 (0)