Skip to main content

Encode and decode pairs of surrogate characters

Project description


surrogates is a small, tested Python 3 package to encode and decode pairs of surrogate characters in Python strings. It is licensed under the MIT license.


# pip3 install --user surrogates


# python3 -m IPython
In [1]: import surrogates

In [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
cd surrogates/
python3 -m venv py3
source py3/bin/activate
./ test

Project details

Download files

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

Files for surrogates, version 1.0.2
Filename, size File type Python version Upload date Hashes
Filename, size surrogates-1.0.2-py3-none-any.whl (4.9 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size surrogates-1.0.2.tar.gz (4.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page