一 参考资料
1 Emoji 全编码表:(我参考的这个)
http://punchdrunker.github.com/iOSEmoji/table_html/flower.html
2 Emoji全编码表
http://code.iamcal.com/php/emoji/
http://blog.csdn.net/iunion/article/details/7241945
3 iOS5/4 Emoji 兼容性:
http://stackoverflow.com/questions/7856775/how-to-convert-the-old-emoji-encoding-to-the-latest-encoding-in-ios5
4 MySQL emoji问题
http://dropblood.com/archives/ios-mysql-emoji
5 Emoji 中文对应表
http://www.iapps.im/wp-content/uploads/2012/02/emoji-pinyin.png?r=010
6 Emoji 参考
http://www.unicode.org/emoji/
对照:
http://www.unicode.org/Public/emoji/2.0//emoji-data.txt
http://www.unicode.org/Public/emoji/2.0//emoji-sequences.txt
http://www.unicode.org/Public/emoji/2.0//emoji-zwj-sequences.txt
7 Emoji UTF-16
http://punchdrunker.github.io/iOSEmoji/table_html/emoji.json
8 windows 7 补丁
https://support.microsoft.com/zh-cn/kb/2729094
9 php
http://ju.outofmemory.cn/entry/46760
http://www.unicode.org/~scherer/emoji4unicode/snapshot/full.html
二 下载资源
emoji图片和编码表 http://download.csdn.net/detail/qdkfriend/4309051
包括emoji文件表,emoji数据编码表(Unicode编码,UTF8编码,UTF16编码,SBUnicode编码)
public static function removeEmoji($text) { $clean_text = ""; // Match Emoticons $regexEmoticons = '/[\x{1F600}-\x{1F64F}]/u'; $clean_text = preg_replace($regexEmoticons, '', $text); // Match Miscellaneous Symbols and Pictographs $regexSymbols = '/[\x{1F300}-\x{1F5FF}]/u'; $clean_text = preg_replace($regexSymbols, '', $clean_text); // Match Transport And Map Symbols $regexTransport = '/[\x{1F680}-\x{1F6FF}]/u'; $clean_text = preg_replace($regexTransport, '', $clean_text); // Match Miscellaneous Symbols $regexMisc = '/[\x{2600}-\x{26FF}]/u'; $clean_text = preg_replace($regexMisc, '', $clean_text); // Match Dingbats $regexDingbats = '/[\x{2700}-\x{27BF}]/u'; $clean_text = preg_replace($regexDingbats, '', $clean_text); return $clean_text; }
static string EmojiToHex(string content) { if (string.IsNullOrEmpty(content)) { return content; } //http://punchdrunker.github.io/iOSEmoji/table_html/emoji.json var regexString = @"\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDEFF]"; var regex = new System.Text.RegularExpressions.Regex(regexString); var contentHex = regex.Replace(content, m => { int r; string r1, r2; r = Convert.ToInt32(m.Value[0]); r1 = "0x" + r.ToString("X"); r = Convert.ToInt32(m.Value[1]); r2 = "0x" + r.ToString("X"); return r1 + r2; }); return contentHex; } static string EmojiFromHex(string hexContent) { if (string.IsNullOrEmpty(hexContent)) { return hexContent; } var regexString = @"0x[0-9A-Z]{4}|0x[0-9A-Z]{2}"; var regex = new System.Text.RegularExpressions.Regex(regexString); var content = regex.Replace(hexContent, m => { var b = m.Value.Substring(2); var b1 = Convert.ToInt32(b, 16); var b2 = Convert.ToChar(b1); return b2.ToString(); }); return content; } //test var c = ""; c = System.Web.HttpUtility.UrlDecode("%ud83d%ude00中文", Encoding.UTF8);// Console.WriteLine(c); //var c1 = c.ToCharArray(); var c1 = EmojiToHex(c); Console.WriteLine(c1); var c2 = EmojiFromHex(c1); Console.WriteLine(c2); return;