Skip to main content

Extension for dealing with valid and invalid UTF-8 strings

Project description

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

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

pyutf8-0.1.1.tar.gz (9.6 kB view details)

Uploaded Source

File details

Details for the file pyutf8-0.1.1.tar.gz.

File metadata

  • Download URL: pyutf8-0.1.1.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyutf8-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2fe8c681c871cad470e21f3f08c2454cafa22ca778d46c8fd3f5256e2cb6820e
MD5 2b7f87a26741259ccd59dc1f579fdb47
BLAKE2b-256 337ed2697ead2f4df3831526ef40f5453fc882e5b8ac68204e9b1b83ac9a25ec

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page