Skip to content

Commit

Permalink
Fix #811 - fetch and show emoji icons
Browse files Browse the repository at this point in the history
  • Loading branch information
severo committed Nov 3, 2016
1 parent 7cc4f13 commit 5af5737
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion daos/mysql/Items.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public function get($options = array()) {
if(isset($options['tag']) && strlen($options['tag'])>0) {
$params[':tag'] = array( "%,".$options['tag'].",%" , \PDO::PARAM_STR );
if ( \F3::get( 'db_type' ) == 'mysql' ) {
$where .= " AND ( CONCAT( ',' , sources.tags , ',' ) LIKE _utf8 :tag COLLATE utf8_bin ) ";
$where .= " AND ( CONCAT( ',' , sources.tags , ',' ) LIKE _utf8mb4 :tag COLLATE utf8mb4_general_ci ) ";
} else {
$where .= " AND ( (',' || sources.tags || ',') LIKE :tag ) ";
}
Expand Down
4 changes: 2 additions & 2 deletions daos/mysql/Statements.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ public static function isFalse($column) {
*/
public static function csvRowMatches($column, $value) {
if( $value[0] == ':' )
$value = "_utf8 $value";
$value = "_utf8mb4 $value";

return "CONCAT(',', $column, ',') LIKE CONCAT('%,', $value, ',%') COLLATE utf8_bin";
return "CONCAT(',', $column, ',') LIKE CONCAT('%,', $value, ',%') COLLATE utf8mb4_general_ci";
}
}
2 changes: 1 addition & 1 deletion daos/mysql/Tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ private function isColorUsed($color) {
*/
public function hasTag($tag) {
if ( \F3::get( 'db_type' ) == 'mysql' ) {
$where = 'WHERE tag = _utf8 :tag COLLATE utf8_bin';
$where = 'WHERE tag = _utf8mb4 :tag COLLATE utf8mb4_general_ci';
} else {
$where = 'WHERE tag=:tag';
}
Expand Down
3 changes: 1 addition & 2 deletions libs/f3/db/sql.php
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,7 @@ function __construct($dsn,$user=NULL,$pw=NULL,array $options=NULL) {
if (!$options)
$options=array();
if (isset($parts[0]) && strstr($parts[0],':',TRUE)=='mysql')
$options+=array(\PDO::MYSQL_ATTR_INIT_COMMAND=>'SET NAMES '.
strtolower(str_replace('-','',$fw->get('ENCODING'))).';');
$options+=array(\PDO::MYSQL_ATTR_INIT_COMMAND=>'SET NAMES utf8mb4;');
$this->pdo=new \PDO($dsn,$user,$pw,$options);
$this->engine=$this->pdo->getattribute(\PDO::ATTR_DRIVER_NAME);
}
Expand Down

0 comments on commit 5af5737

Please sign in to comment.