Skip to content


codext implements some common Web-related encodings.

HTML Entities

This implements the full list of characters available at this reference.

Codec Conversions Aliases Comment
html text <-> HTML entities html-entity, html_entities implements entities according to this reference
>>> codext.encode("Тħĩş Їś ą Ţêšŧ", "html")
'&Tcy;&hstrok;&itilde;&scedil; &YIcy;&sacute; &aogon; &Tcedil;&ecirc;&scaron;&tstrok;'
>>> codext.decode("&Tcy;&hstrok;&itilde;&scedil; &YIcy;&sacute; &aogon; &Tcedil;&ecirc;&scaron;&tstrok;", "html-entities")
'Тħĩş Їś ą Ţêšŧ'


This handles URL encoding, regardless of the case when decoding and with no error.

Codec Conversions Aliases Comment
url text <-> URL encoded text url, urlencode
>>> codecs.encode("?=this/is-a_test/../", "url")
>>> codext.decode("%3F%3Dthis%2Fis-a_test%2F%2E%2E%2F", "urlencode")
>>> codext.decode("%3f%3dthis%2fis-a_test%2f%2e%2e%2f", "urlencode")