Emoji Convert & Replace & Entities & Joiner
brightcells / pyemoji Goto Github PK
View Code? Open in Web Editor NEWEmoji Convert & Replace & Entities & Joiner
Home Page: https://pypi.python.org/pypi/pyemoji
Emoji Convert & Replace & Entities & Joiner
Home Page: https://pypi.python.org/pypi/pyemoji
pyemoji.entities('❥')
Traceback (most recent call last):
File "lib\site-packages\pyemoji\main.py", line 32, in repl_func
decimal_num = int(hex_num, 16)
ValueError: invalid literal for int() with base 16: '0xu2765'
Probably could be solved by adding lstrip('u')
on line 31:
hex_num = '0x{0}'.format(matched.group().encode('unicode_escape').decode('utf8').lstrip('\\').lstrip('U').lstrip('0').lstrip('u'))
In [16]: print pyemoji.decode('\\u7b11\\u8138\\u8868\\u60c5\\uff1a\\U0001f604')
---------------------------------------------------------------------------
UnicodeEncodeError Traceback (most recent call last)
<ipython-input-16-1df3327dc151> in <module>()
----> 1 print pyemoji.decode('\\u7b11\\u8138\\u8868\\u60c5\\uff1a\\U0001f604')
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-5: ordinal not in range(128)
In [17]: print pyemoji.replace(u'笑脸表情:😄')
ERROR - failed to write data to stream: <open file '<stdout>', mode 'w' at 0x7facaf889150>
At first, thank you for opening your code. :)
I review the code to look for the regex of filtering emoji.
# Refer: http://stackoverflow.com/questions/26568722/remove-unicode-emoji-using-re-in-python
# Refer: http://stackoverflow.com/questions/22706522/python-remove-ios-emoji-characters-in-a-unicode-str-to-avoid-databaseerror-in
try:
# Wide UCS-4 build
highpoints = re.compile('[\U00010000-\U0010ffff]')
except re.error:
# Narrow UCS-2 build
highpoints = re.compile('[\uD800-\uDBFF][\uDC00-\uDFFF]')
https://stackoverflow.com/questions/13729638/how-can-i-filter-emoji-characters-from-my-input-so-i-can-save-in-mysql-5-5
according to the reply of David Mabodo, the regex, which you are using, is not perfect.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.