Shared interface to IDNA encoding and decoding, using the idna PyPI package if available, otherwise the stdlib implementation.

Function _idnaBytes Convert some text typed by a human into some ASCII bytes.
Function _idnaText Convert some IDNA-encoded octets into some human-readable text.
def _idnaBytes(text): (source)

Convert some text typed by a human into some ASCII bytes.

This is provided to allow us to use the partially-broken IDNA implementation in the standard library if the more-correct idna package is not available; service_identity is somewhat stricter about this.

ParameterstextA domain name, hopefully. (type: unicode)
ReturnsThe domain name's IDNA representation, encoded as bytes. (type: bytes)
def _idnaText(octets): (source)

Convert some IDNA-encoded octets into some human-readable text.

Currently only used by the tests.

ParametersoctetsSome bytes representing a hostname. (type: bytes)
ReturnsA human-readable domain name. (type: unicode)
API Documentation for Twisted, generated by pydoctor at 2017-09-23 19:45:03.