Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hartwork/surrogates
:relieved: Encode and decode pairs of surrogate characters in Python 3
https://github.com/hartwork/surrogates
emoji emoji-unicode python python3 surrogates unicode
Last synced: about 2 months ago
JSON representation
:relieved: Encode and decode pairs of surrogate characters in Python 3
- Host: GitHub
- URL: https://github.com/hartwork/surrogates
- Owner: hartwork
- License: mit
- Created: 2019-11-25T17:26:29.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-03-09T02:27:59.000Z (almost 3 years ago)
- Last Synced: 2024-10-12T23:36:06.696Z (2 months ago)
- Topics: emoji, emoji-unicode, python, python3, surrogates, unicode
- Language: Python
- Homepage: https://pypi.org/project/surrogates/
- Size: 11.7 KB
- Stars: 11
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
# Surrogates
`surrogates` is a small, tested Python 3 package
to encode and decode pairs of
[surrogate characters](https://en.wikipedia.org/wiki/Universal_Character_Set_characters#Surrogates)
in Python strings.
It is licensed under [the MIT license](https://opensource.org/licenses/MIT).# Installation
```console
# pip3 install --user surrogates
```# Usage
```console
# python3 -m IPython
[..]
In [1]: import surrogatesIn [2]: surrogates.encode('😘')
Out[2]: '\ud83d\ude18'In [3]: surrogates.decode('\uD83D\uDE18')
Out[3]: '😘'In [4]: hex(ord('😘'))
Out[4]: '0x1f618'
```# Develop & run tests
```
cd "$(mktemp -d)"
git clone https://github.com/hartwork/surrogates
cd surrogates/
python3 -m venv py3
source py3/bin/activate./setup.py test
pip3 install pre-commit
pre-commit install --install-hooks
```