Python Codec for ITU T.61 Strings

2.0.0 · active · verified Thu Apr 16

t61codec is a Python library that provides a codec for handling ITU T.61 character strings. It allows encoding Python strings into T.61 byte sequences and decoding T.61 byte sequences back into Python strings. The current version is 2.0.0 and it maintains a semantic versioning release cadence, though updates are infrequent.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to register the t61codec and then use Python's built-in `codecs` module to encode and decode strings using the 't.61' encoding.

import t61codec
import codecs

t61codec.register()

# Encode a Python string to T.61 bytes
python_string = "Hello, World!"
t61_bytes = codecs.encode(python_string, 't.61')
print(f"Encoded: {t61_bytes!r}")

# Decode T.61 bytes back to a Python string
decoded_string = codecs.decode(t61_bytes, 't.61')
print(f"Decoded: {decoded_string}")

# Example with characters that might be specific to T.61 (if applicable)
# For simplicity, using basic ASCII characters as T.61 is an 8-bit encoding
# For specific non-ASCII T.61 characters, consult ITU-T T.61 standard.

view raw JSON →