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.
And can 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.3.tar.gz
(4.0 kB
view details)
Built Distribution
File details
Details for the file pyemoji-1.0.3.tar.gz
.
File metadata
- Download URL: pyemoji-1.0.3.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24797823f469f93b267659ad32a859a6c769de806b351e6c2e6b9f37cdf788f1 |
|
MD5 | 70dce367eeda67b57575da7fa4e1046b |
|
BLAKE2b-256 | e8da86f1bc29666dca038ea84dc2fc3b76879134421a6e38e24487745778c74e |
File details
Details for the file pyemoji-1.0.3-py2.py3-none-any.whl
.
File metadata
- Download URL: pyemoji-1.0.3-py2.py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 760ca758d0dc6b8bbd1725cfe9006a5f70169ed2fbf40ea0950d18bdeac356d0 |
|
MD5 | c85f29fbaa03e7cf55c0fd4c45dc51d5 |
|
BLAKE2b-256 | 6ec6fc56e9d6e2f7fb4829ae297b225bef3b2b42d6ba05c5aeda936dfc0aff4f |