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.2a2.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.2a2-py3-none-any.whl (114.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: translit-0.2a2.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.2a2.tar.gz
Algorithm Hash digest
SHA256 da82b3d4caa6ab7c50faa9ecce0123f6bf5cf7e794914410a5f41f8c1ddf7199
MD5 d8797d88060e73542a67f7a371ff2fbc
BLAKE2b-256 061d15d7583f7fbb10da79e4ed1dc26a3135c53263e0d9f9740bfd8ae2a8ed00

See more details on using hashes here.

File details

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

File metadata

  • Download URL: translit-0.2a2-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.2a2-py3-none-any.whl
Algorithm Hash digest
SHA256 99ed3aeb6657d43fe8c82494f51032550d62dabff35c6f7a1145856c4213a6e5
MD5 0af0586ffce8bf25dc36877be0d3baee
BLAKE2b-256 22eb9c896dfb4db1e89448f2c4343fecbc2063a4ec96b87c3a8d4554345632ba

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