Metadata-Version: 2.5
Name: t61codec
Version: 3.0.0
Summary: Python Codec for ITU T.61 Strings
Project-URL: Homepage, https://github.com/exhuma/t61codec
Project-URL: Repository, https://github.com/exhuma/t61codec
Project-URL: Documentation, https://t61codec.readthedocs.io
Project-URL: Changelog, https://github.com/exhuma/t61codec/blob/master/CHANGES.rst
Project-URL: Issues, https://github.com/exhuma/t61codec/issues
Author-email: Michel Albert <michel@albert.lu>
License-Expression: MIT
License-File: LICENSE
Keywords: T61String,asn1,codec,encoding,itu,ldap,t.61,t61,teletex,x500
Classifier: Development Status :: 6 - Mature
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Communications
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing
Classifier: Typing :: Typed
Requires-Python: >=3.11
Description-Content-Type: text/x-rst

Python Codec for ITU T.61 Strings
=================================

.. image:: https://img.shields.io/pypi/v/t61codec.svg
   :target: https://pypi.org/project/t61codec/
   :alt: PyPI version

.. image:: https://img.shields.io/pypi/pyversions/t61codec.svg
   :target: https://pypi.org/project/t61codec/
   :alt: Supported Python versions

.. image:: https://github.com/exhuma/t61codec/actions/workflows/pythonpackage.yml/badge.svg
   :target: https://github.com/exhuma/t61codec/actions/workflows/pythonpackage.yml
   :alt: CI status

.. image:: https://readthedocs.org/projects/t61codec/badge/?version=latest
   :target: https://t61codec.readthedocs.io
   :alt: Documentation status

A Python codec for ITU-T Rec. T.61 (11/1988), the 8-bit Teletex code,
implemented to the letter of the recommendation: accented letters are
composed from their diacritic prefix, only the combinations of Figure B-1
are accepted, and undefined bytes and control functions are errors.

For background see https://en.wikipedia.org/wiki/ITU_T.61 and
https://www.itu.int/rec/T-REC-T.61-198811-S/en


Project status
--------------

The codec implements a fixed standard (ITU-T T.61, 1988) and is
feature-complete. The project is in maintenance mode: only bug fixes, support
for new Python versions and security fixes are accepted. Feature requests will
be declined unless a change in Python itself requires one. Semantic Versioning
applies.

Upgrading from 2.x
~~~~~~~~~~~~~~~~~~

Version 3.0.0 changes the decoding and encoding results to follow the
recommendation exactly. Please read the `changelog
<https://github.com/exhuma/t61codec/blob/master/CHANGES.rst>`_ before
upgrading.


Installation
------------

Installation follows the standard Python procedure:

::

    pip install t61codec


The package uses Semantic Versioning 2.0 (https://semver.org/spec/v2.0.0.html).


Usage
-----

The codec can be registered into Python's codec registry. A helper method has
been provided::

    import t61codec
    t61codec.register()

Please see the notes on `codecs.register
<https://docs.python.org/3/library/codecs.html#codecs.register>`_!

After registering, the codec is available as either ``'t61'`` or ``'t.61'``::

    >>> b'Hello T.61: \xe0'.decode('t.61')
    'Hello T.61: Ω'
    >>> 'Hello T.61: Ω'.encode('t.61')
    b'Hello T.61: \xe0'
    >>> b'Caf\xc2e'.decode('t.61')
    'Café'
    >>> 'Café'.encode('t.61')
    b'Caf\xc2e'

Real-world T61String data (for example in X.509 certificates) is often
Latin-1 rather than T.61, because OpenSSL treats it that way. This codec
decodes strictly according to T.61, so such data may raise errors or
decode differently.
