pyutf8 provides tools to efficiently deal with the validation and cleanup of UTF-8 strings. The primary use case is “garbage in utf-8 out”.
Usage:
>>> from pyutf8 import valid_utf8_bytes
>>> SNOWMAN = u'\N{SNOWMAN}'
>>> SNOWMAN_BYTES = SNOWMAN.encode('utf-8')
>>> valid_utf8_bytes(SNOWMAN) == SNOWMAN_BYTES
True
>>> valid_utf8_bytes(SNOWMAN_BYTES) == SNOWMAN_BYTES
True
>>> valid_utf8_bytes('\xff' + SNOWMAN_BYTES + '\xff') == SNOWMAN_BYTES
True
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyutf8-0.1.tar.gz
(9.6 kB
view details)
File details
Details for the file pyutf8-0.1.tar.gz.
File metadata
- Download URL: pyutf8-0.1.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2bbe4a23a2e922d97b78d783382e46318aad13e53bda198d5cccda94a96aeee1
|
|
| MD5 |
8dcb97152ac6bc5625f3b75007be8502
|
|
| BLAKE2b-256 |
38b71747b421ccb438be2ba094fd27e71c52da10567546203bfdb6e2922087df
|