Skip to content

Instantly share code, notes, and snippets.

View GiancarloGomez's full-sized avatar
🛩️
Music, Aviation, Code ....

Giancarlo Gomez GiancarloGomez

🛩️
Music, Aviation, Code ....
View GitHub Profile
@GiancarloGomez
GiancarloGomez / my_emoji_safe.cnf
Last active September 7, 2016 05:19
Setting required to support utf8mb4 in mySQL server. This example was pulled from the following post => https://mathiasbynens.be/notes/mysql-utf8mb4 (http://www.giancarlogomez.com/2016/09/emoji-support-with-coldfusion-and-mysql.html)
[client]
default-character-set = utf8mb4
[mysql]
default-character-set = utf8mb4
[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
@GiancarloGomez
GiancarloGomez / cleanEmoji.cfc
Last active September 11, 2016 14:30
Simple function that sends a string to the clean_emoji.php using a cfhttp call and returns a string with all emoji removed. https://gist.github.com/GiancarloGomez/e62928a665ef796464137bafc6cb20ec (http://www.giancarlogomez.com/2016/09/emoji-support-with-coldfusion-and-mysql.html)
string function cleanEmoji(required string value){
var gotourl = "/clean_emoji.php";
var php = new http(url:gotourl,method:"post");
php.addParam(type:"formfield",name:"value",value:arguments.value);
// Return trimmed response
return trim(php.send().getPrefix().fileContent);
}
<?php
function removeEmoji($text) {
$clean_text = "";
// Match Emoticons
$regexEmoticons = '/[\x{1F600}-\x{1F64F}]/u';
$clean_text = preg_replace($regexEmoticons, '', $text);
// Match Miscellaneous Symbols and Pictographs