The mayo in your unicode sandwich
Project description
unicode_mayo is the mayo in your unicode sandwich. In your development environment, use it as a wrapper around unicode strings to see if they’re accidentally coming in to contact with byte strings. This can help catch unicode encode/decode errors before they happen in production!
Installation
Installation via pip:
pip install unicode_mayo
Usage
Something like:
>>> import unicode_mayo >>> wrapped = unicode_mayo.UnicodeSafetyWrapper(u'safety at last!') >>> wrapped.encode('utf-8') 'safety at last!' >>> wrapped + u' woohoo!' u'safety at last! woohoo!' >>> wrapped + 'evil bytestring' Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/eyalr/personal_work/unicode_mayo/src/unicode_mayo/__init__.py", line 55, in __add__ _fail_on_bytes(other) File "/Users/eyalr/personal_work/unicode_mayo/src/unicode_mayo/__init__.py", line 90, in _fail_on_bytes _fail_on_bytes_helper(other) File "/Users/eyalr/personal_work/unicode_mayo/src/unicode_mayo/__init__.py", line 81, in _fail_on_bytes_helper 'Attempted string formatting without decoding utf-8' TypeError: Attempted string formatting without decoding utf-8
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
unicode_mayo-0.6.0.tar.gz
(3.2 kB
view hashes)
Built Distribution
Close
Hashes for unicode_mayo-0.6.0-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5097a91c85a19782cf43b4d015e472ae17afb13dfd41020d92173b8a4c7f17b5 |
|
MD5 | dfbf865074035be5ac28141d72cf8e27 |
|
BLAKE2b-256 | 27223f11b3cd7d088a770efe37c8dae86c151f54d7699c158ca746c767e2b5c0 |