emoji

print python emoji as unicode string

Deadly 提交于 2019-11-26 16:54:07
问题 I've been trying to output as '\U0001f604' instead of the smiley but it doesn't seem to work. i tried using repr() but it gives me this '\xf0\x9f\x98\x84'. Currently it outputs as the smiley which is not what I wanted. encode('unicode_escape') gives me a UnicodeDecodeError. The smiley was passed as a string to a class method in python. i.e. "I am happy " Appreciate if anyone could help. Sorry for the big smiley. The markdown doesn't seem to work here. 回答1: >>> print u'\U0001f604'.encode(

How to detect emoji using javascript

霸气de小男生 提交于 2019-11-26 16:51:46
问题 I need help for how to detect if an input contains a Japanese emoji/emoticon. Currently my character set is charset=utf-8 . On inputting text, the user can enter Japanese characters/alpanumerics/symbols but if they insert an emoji, onsubmit JavaScript will check if there is an emoji, error message will display. I can't get this to work because I have no idea on how to detect an emoji in JavaScript? 回答1: You can use the following regex: /(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-

Inconsistent Unicode Emoji Glyphs/Symbols

心不动则不痛 提交于 2019-11-26 16:45:26
I've been trying to make use of the Unicode symbols for astrology in products for both Apple and iOS. I'm getting inconsistent results, as shown here: Most of these are coming out as I like, but for some reason the Taurus symbol is appearing one way on the first line, following the Moon, and a very different way, with the Emoji-like purple button, when it follows Mars. These results are consistent for different symbols and across Apple hardware; here's a screen capture from my phone showing the same problem with some other signs - Scorpio comes out all right, but Libra and Cancer are buttons.

change the keyboard layout to emoji

非 Y 不嫁゛ 提交于 2019-11-26 16:37:47
问题 is it possible to change the keyboard layout to emoji when a UITextField becomes the first responder ? or according to a user action like tapping a UIButton i know that i can change the keyboard layout to one of these typedef enum { UIKeyboardTypeDefault, // Default type for the current input method. UIKeyboardTypeASCIICapable, // Displays a keyboard which can enter ASCII characters, non-ASCII keyboards remain active UIKeyboardTypeNumbersAndPunctuation, // Numbers and assorted punctuation.

PHP : writing a simple removeEmoji function

一世执手 提交于 2019-11-26 15:12:08
I'm looking for a simple function that would remove Emoji characters from instagram comments. What I've tried for now (with a lot of code from examples I found on SO & other websites) : // PHP class public static function removeEmoji($string) { // split the string into UTF8 char array // for loop inside char array // if char is emoji, remove it // endfor // return newstring } Any help would be appreciated sglessard I think the preg_replace function is the simpliest solution. As EaterOfCode suggests, I read the wiki page and coded new regex since none of SO (or other websites) answers seemed to

How to set emoji by unicode in a textview?

≡放荡痞女 提交于 2019-11-26 14:10:54
Hi I'd like to do the following: ??? unicode = U+1F60A String emoji = getEmojiByUnicode(unicode) String text = "So happy " textview.setText(text + emoji); to get this in my textview: So happy 😊 How can I implement getEmojiByUnicode(unicode) ? What type should the unicode variable be? (String, char, int?) Please note that I do NOT want to use Drawables! Gilbert Giesbert Found a solution: In my unicode I replaced ' U+ ' by ' 0x ' Example: replace ' U+1F60A ' by ' 0x1F60A ' This way I got an 'int' like int unicode = 0x1F60A; Which can be used with public String getEmojiByUnicode(int unicode){

removing emojis from a string in Python

青春壹個敷衍的年華 提交于 2019-11-26 13:28:33
I found this code in Python for removing emojis but it is not working. Can you help with other codes or fix to this? I have observed all my emjois start with \xf but when I try to search for str.startswith("\xf") I get invalid character error. emoji_pattern = r'/[x{1F601}-x{1F64F}]/u' re.sub(emoji_pattern, '', word) Here's the error: Traceback (most recent call last): File "test.py", line 52, in <module> re.sub(emoji_pattern,'',word) File "/usr/lib/python2.7/re.py", line 151, in sub return _compile(pattern, flags).sub(repl, string, count) File "/usr/lib/python2.7/re.py", line 244, in _compile

iOS 5: How to convert an Emoji to a unicode character?

独自空忆成欢 提交于 2019-11-26 12:35:33
问题 I want to convert an Emoji to a unicode character in iOS 5. For example, converting to \\ue415 . I went to NSStringEncoding in NSString Class Reference. In iOS 4, NSUTF16BigEndianStringEncoding and NSUTF32BigEndianStringEncoding gave me <e415> and <0000e415> , respectively, which are quite close to what I want. In iOS 5, the results are different. It gaves <d83dde04> and <0001f604> . How can I get \\ue415 for in iOS 5? Thank you. 回答1: \ue415 is part of the legacy encoding for emoji and is

How do I remove emoji from string

…衆ロ難τιáo~ 提交于 2019-11-26 09:43:22
问题 My problem is to remove emoji from a string, but not CJK (Chinese, Japanese, Korean) characters from a string using regex. I tried to use this regex: REGEX = /[^\\u1F600-\\u1F6FF\\s]/i This regex works fine except it also detects the Chinese, Japanese and Korean character where I need those characters. Any idea how to solve this issue? 回答1: Karol S already provided a solution, but the reason might not be clear: "\u1F600" is actually "\u1F60" followed by "0" : "\u1F60" # => "ὠ" "\u1F600" # =>

Swift countElements() return incorrect value when count flag emoji

a 夏天 提交于 2019-11-26 08:24:08
问题 let str1 = \"🇩🇪🇩🇪🇩🇪🇩🇪🇩🇪\" let str2 = \"🇩🇪.🇩🇪.🇩🇪.🇩🇪.🇩🇪.\" println(\"\\(countElements(str1)), \\(countElements(str2))\") Result: 1, 10 But should not str1 have 5 elements? The bug seems only occurred when I use the flag emoji. 回答1: Update for Swift 4 (Xcode 9) As of Swift 4 (tested with Xcode 9 beta) grapheme clusters break after every second regional indicator symbol, as mandated by the Unicode 9 standard: let str1 = "🇩🇪🇩🇪🇩🇪🇩🇪🇩🇪" print(str1.count) // 5 print(Array(str1)) // ["🇩🇪", "🇩🇪", "🇩🇪",