Skip to main content

Transliterate between Unicode and smaller coded character sets

Project description

Example usage

>>> import translit
>>> text = "La question, c’est\u202f: «\u202fOù est le cœur\u202f?\u202f»"

Downgrade text to Latin-1:

>>> translit.downgrade(text, "latin-1")
"La question, c'est\xa0: «\xa0Où est le coeur\xa0?\xa0»"

Downgrade text to ASCII:

>>> translit.downgrade(text, "ascii")
'La question, c\'est : "Ou est le coeur ?"'

Downgrade and encode to Latin-1:

>>> buf = text.encode("latin-1/translit")
>>> buf
b"La question, c'est\xa0: \xab\xa0O\xf9 est le coeur\xa0?\xa0\xbb"

Decoding, the normal way:

>>> buf.decode("latin-1")
"La question, c'est\xa0: «\xa0Où est le coeur\xa0?\xa0»"

Decoding, the upgraded way:

>>> buf.decode("latin-1/translit/fr")
'La question, c’est\u202f: «\u202fOù est le cœur\u202f?\u202f»'

Installation

To install the package for Python 3, use:

$ ./setup.py install

To install the package for Python 2, use:

$ python2 setup.py install

On Windows, you may use one of the MSI binary packages provided on the download page.

Requirements

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

translit-0.2.tar.gz (112.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

translit-0.2-py3-none-any.whl (114.3 kB view details)

Uploaded Python 3

File details

Details for the file translit-0.2.tar.gz.

File metadata

  • Download URL: translit-0.2.tar.gz
  • Upload date:
  • Size: 112.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for translit-0.2.tar.gz
Algorithm Hash digest
SHA256 97b12b4dc54e154500b278e40ff8f805b3d39dbc4c2245ec7fbf71882647daa0
MD5 422be2287fcba8fd03765e5579b07180
BLAKE2b-256 1bfb200fa57fbf457ea1194f795a6a54328647dc70e9e1f0e68b03c68a6f0b3b

See more details on using hashes here.

File details

Details for the file translit-0.2-py3-none-any.whl.

File metadata

  • Download URL: translit-0.2-py3-none-any.whl
  • Upload date:
  • Size: 114.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for translit-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a341d01f26dd9de5f9892e6a35fd755aae96045f0f9c7520285008af33c7e831
MD5 2967e89786501684359073f2a31108c7
BLAKE2b-256 85b9b05afbdfe50cfaffa274b8a9f8d835284db80988d71f2760d6d2401d030a

See more details on using hashes here.

Supported by

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