Skip to main content

Library for simplified work with encoding

Project description

PyByle

PyByle is a small library for easy interaction with file and string encodings.

The library currently uses python 3.10 and supports 97 possible encodings The next version of python 3.11 supports all the same encodings as python 3.10 You can learn more about the list of encodings for different versions of the interpreter here: https://docs.python.org/3.10/library/codecs.html#standard-encodings

Installing

pip install pybyle

Getting a complete list of supported characters in a given encoding.

import pybyle


pybyle.get_charset('ascii')  # ['\x00', '\x01', '\x02', '\x03', '\x04', ...]

Converting a string from one encoding to another. Attention! All unsupported characters will be replaced with the set character!

import pybyle


pybyle.convert_encoding('Привет, мир! Hello, world!', encoding='ascii')  # ??????, ???! Hello, world!
pybyle.convert_encoding('Привет, мир! Hello, world!', encoding='ascii', substitute='_')  # ______, ___! Hello, world!

Specifies the encoding of the binary string.

import pybyle


pybyle.detect_bytes_encoding(b'\xd0\x9f\xd1\x80\xd0\xb8\xd0\xb2\xd0\xb5\xd1\x82')  # utf-8

Determining the encoding for a given file.

import pybyle


pybyle.detect_file_encoding('example_utf_8_file.txt')  # utf-8
pybyle.detect_file_encoding('example_cp037_file.txt')  # cp037

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

pybyle-1.0.0.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

pybyle-1.0.0-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file pybyle-1.0.0.tar.gz.

File metadata

  • Download URL: pybyle-1.0.0.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.10.0 Windows/10

File hashes

Hashes for pybyle-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0f4d99c63199ed7ce978c41c7d6d8d660949e2a4c4fe8d0e3c80f0ed7f8b0497
MD5 5bfba27e99c4585cf9e2112685e49d31
BLAKE2b-256 909fa63d1639e36c98ae45d2966bfdab4d9d88e0c830fa72a9c22c54ce367bc4

See more details on using hashes here.

File details

Details for the file pybyle-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pybyle-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.10.0 Windows/10

File hashes

Hashes for pybyle-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d43f5c4c4b8cb59da7dfa042495fc67096feca89e739ace3fd5e93dab6d4d264
MD5 c6dbd7f542d93d6228e5128357d80725
BLAKE2b-256 5ac343ef00d6756af420ce6c711c9e398d9fa88cf79fbd84f04e64386a551066

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