Skip to main content

Emoji Convert & Replace & Entities

Project description

When MySQL version greater than 5.5.3 have utf8mb4 CHARACTER SET which can store emoji.

But when MySQL version lower than 5.5.3 can’t directly store emoji.

By using pyemoji’s encode/decode & replace & entities function.

Similar: https://pypi-hypernode.com/pypi/pymoji

Installation

pip install pyemoji

Usage

encode/decode:

Python 2.7.5 (default, Mar  9 2014, 22:15:05)
Type "copyright", "credits" or "license" for more information.

IPython 4.0.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import pyemoji

In [2]: pyemoji.encode(u'笑脸表情:😄')
Out[2]: '\\u7b11\\u8138\\u8868\\u60c5\\uff1a\\U0001f604'

In [3]: print pyemoji.encode(u'笑脸表情:😄')
\u7b11\u8138\u8868\u60c5\uff1a\U0001f604

In [4]: pyemoji.decode('\\u7b11\\u8138\\u8868\\u60c5\\uff1a\\U0001f604')
Out[4]: u'\u7b11\u8138\u8868\u60c5\uff1a\U0001f604'

In [5]: print pyemoji.decode('\\u7b11\\u8138\\u8868\\u60c5\\uff1a\\U0001f604')
笑脸表情:😄

replace:

In [6]: pyemoji.replace(u'笑脸表情:😄')
Out[6]: u'\u7b11\u8138\u8868\u60c5\uff1a\ufffd'

In [7]: print pyemoji.replace(u'笑脸表情:😄')
笑脸表情:�

In [8]: pyemoji.replace(u'笑脸表情:😄', '')
Out[8]: u'\u7b11\u8138\u8868\u60c5\uff1a'

In [9]: print pyemoji.replace(u'笑脸表情:😄', '')
笑脸表情:

entities:

In [10]: pyemoji.entities(u'笑脸表情:😄')
Out[10]: u'\u7b11\u8138\u8868\u60c5\uff1a😄'

In [11]: print pyemoji.entities(u'笑脸表情:😄')
笑脸表情:😄

Params

unic:

In [4]: import pyemoji

In [5]: pyemoji.encode('笑脸表情:😄')
Out[5]: '\\u7b11\\u8138\\u8868\\u60c5\\uff1a\\U0001f604'

In [6]: pyemoji.encode(u'笑脸表情:😄')
Out[6]: '\\u7b11\\u8138\\u8868\\u60c5\\uff1a\\U0001f604'

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyemoji-1.0.2.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

pyemoji-1.0.2-py2.py3-none-any.whl (5.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pyemoji-1.0.2.tar.gz.

File metadata

  • Download URL: pyemoji-1.0.2.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyemoji-1.0.2.tar.gz
Algorithm Hash digest
SHA256 f6e967e1cfb49b103e91bd5959eb09f57b989a21c7c00a4167c87c77515e99d0
MD5 508cd8bee84b5d6f1991806a24ef60f7
BLAKE2b-256 dc61905ba912913a8f5fb396233556507ad2ea9c0a4339a35c9533bce7f7c4e1

See more details on using hashes here.

File details

Details for the file pyemoji-1.0.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pyemoji-1.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 68906a7ad7e2a0df26aa49b181cb72ad4c61bfe4e54489a3d165f2bbf0fac2ad
MD5 c29ee558d3dc2d5e07f5df2b9680bc36
BLAKE2b-256 26f0d63e28d989641aefaa66cfba695eafa7456d835f23fcec4fd02af251db24

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page