Skip to content

Commit

Permalink
Changed mysql charset to utf8mb4 from utf8 because utf8 is an alias f…
Browse files Browse the repository at this point in the history
…or utf8mb3 which doesn't support emojis.
  • Loading branch information
shannah committed Oct 26, 2022
1 parent 2837135 commit f17a222
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions Dataface/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -979,11 +979,11 @@ function __construct($conf = null) {
define('XF_OUTPUT_ENCODING', $this->_conf['oe']);

if ( $this->_conf['oe'] == 'UTF-8' ){
$res = xf_db_query('set character_set_results = \'utf8\'', $this->_db);
xf_db_query("SET NAMES utf8", $this->_db);
$res = xf_db_query('set character_set_results = \'utf8mb4\'', $this->_db);
xf_db_query("SET NAMES utf8mb4", $this->_db);
}
if ( $this->_conf['ie'] == 'UTF-8' ){
$res = xf_db_query('set character_set_client = \'utf8\'', $this->_db);
$res = xf_db_query('set character_set_client = \'utf8mb4\'', $this->_db);

}

Expand Down
6 changes: 3 additions & 3 deletions xf/db/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ public function db() {
$conf = $this->conf;
$this->db = xf_db_connect($conf['host'], $conf['user'], $conf['password'], true /* necessary to force new link */);
xf_db_select_db($conf['name'], $this->db);
xf_db_query('set character_set_results = \'utf8\'', $this->db);
xf_db_query("SET NAMES utf8", $this->db);
xf_db_query('set character_set_client = \'utf8\'', $this->db);
xf_db_query('set character_set_results = \'utf8mb4\'', $this->db);
xf_db_query("SET NAMES utf8mb4", $this->db);
xf_db_query('set character_set_client = \'utf8mb4\'', $this->db);
unset($this->conf);
}
return $this->db;
Expand Down

0 comments on commit f17a222

Please sign in to comment.