Giter Site home page Giter Site logo

pyemoji's Introduction

pyemoji

Emoji Convert & Replace & Entities & Joiner

pyemoji's People

Contributors

brightcells avatar

Stargazers

João Camacho avatar Frankey avatar Anand Tripathi avatar

Watchers

 avatar  avatar

Forkers

phatham

pyemoji's Issues

Error while entitling ❤ emoji

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'))

Ubuntu Terminator Errors

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>

the regex of filter emoji may be updated

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.