Bootstring encoding and decoding (RFC 3492)
Project description
Python Bootstring
This is a Python implementation of the Bootstring encoding algorithm, as described in RFC 3492.
The Bootstring encoding algorithm is used to encode Unicode strings into ASCII strings, and is used by the Punycode encoding algorithm.
This implementation passes all the tests in the RFC 3492 test suite, however is is not optimized for performance and might fail on edge cases not covered by the test suite.
To use it, simply pip install git+https://github.com/frereit/bootstring/
and import bootstring
:
>>> import bootstring
>>> bootstring.encode("hello, world!")
'hello, world!-'
>>> bootstring.decode("hello, world!-")
'hello, world!'
>>> bootstring.encode("döner")
'dner-5qa'
>>> bootstring.decode("dner-5qa")
'döner'
>>> bootstring.encode("他们为什么不说中文")
'ihqwcrb4cv8a8dqg056pqjye'
>>> bootstring.decode("ihqwcrb4cv8a8dqg056pqjye")
'他们为什么不说中文'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for bootstring-1.0.0.post1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e630a57dd2ca4a909443fc0795bef6a271a3124914e0ae0df2c021d262a17d8f |
|
MD5 | c9f1924821858b8ccc523a0c84744ce9 |
|
BLAKE2b-256 | 77256ff1990dd6eb4b454233f22e97ac2ed65556ad13910e500e86f2e13af244 |