Skip to content

Languages

codext also adds some common languages for encoding.


Braille

It supports letters, digits and some special characters.

Codec Conversions Aliases Comment
braille text <-> braille symbols Python 3 only
>>> codext.encode("this is a test", "braille")
'⠞⠓⠊⠎⠀⠊⠎⠀⠁⠀⠞⠑⠎⠞'
>>> codext.encode("THIS IS A TEST", "braille")
'⠞⠓⠊⠎⠀⠊⠎⠀⠁⠀⠞⠑⠎⠞'
>>> codext.decode("⠞⠓⠊⠎⠀⠊⠎⠀⠁⠀⠞⠑⠎⠞", "braille")
'this is a test'

Fancy alphabets

Unicode has styled versions of the Latin letters and of the digits, often used to write "fancy" text (e.g. in social networks) or to obfuscate text (e.g. to evade filters): the mathematical alphanumeric symbols (some letters being in the Letterlike Symbols block, e.g. ℬ or ℎ), the circled and parenthesized letters and digits, the full-width forms of ASCII and the small capitals. Encoding writes the letters and digits of the text in the given style, keeping the other characters, while decoding writes back the characters of this style ; fancy without a style decodes all of them at once (e.g. for text mixing several styles).

Codec Conversions Aliases Comment
fancy text <-> styled text fancy-bold, fancy-italic, fancy-bold-italic, fancy-script, fancy-bold-script, fancy-fraktur, fancy-bold-fraktur, fancy-double-struck, fancy-sans-serif, fancy-sans-serif-bold, fancy-sans-serif-italic, fancy-sans-serif-bold-italic, fancy-monospace, fancy-circled, fancy-parenthesized parametrized with the style (required for encoding) ; digits only in the bold, double-struck, sans-serif, sans-serif bold, monospace, circled and parenthesized (except 0) styles
fullwidth text <-> full-width text full-width, fancy-fullwidth printable ASCII characters, the space being written as an ideographic space
smallcaps text <-> text with small capitals small-caps, fancy-smallcaps lowercase letters only (uppercase letters kept), except x that has no small capital

NFKC normalization

The NFKC normalization (unicodedata.normalize("NFKC", ...)) also undoes the mathematical, circled and full-width styles, but not the parenthesized one (giving e.g. (a)) nor the small capitals. Unlike this codec, it changes other characters as well (e.g. ligatures and superscripts).

>>> codext.encode("Hello World", "fancy-script")
'ℋℯ𝓁𝓁ℴ 𝒲ℴ𝓇𝓁𝒹'
>>> codext.encode("Hello World", "fancy-double-struck")
'ℍ𝕖𝕝𝕝𝕠 𝕎𝕠𝕣𝕝𝕕'
>>> codext.encode("Hello World", "smallcaps")
'Hᴇʟʟᴏ Wᴏʀʟᴅ'
>>> codext.decode("𝐇𝖊𝚕ⓛ⒪ wᴏʀʟᴅ", "fancy")
'Hello world'

Galactic

This implements the Standard Galactic Alphabet, i.e. the language of Minecraft's enchanting table, using resembling Unicode characters as most online translators (e.g. LingoJam) do: one character for most letters, but !¡ for p, ℸ ̣ (with a combining dot below) for t, ̇/ (with a combining dot above) for x and || for y. Other ASCII characters are kept, except ! and |.

When decoding, other lookalike characters and the shorter forms of p, t, x and y are also accepted, and ASCII characters (e.g. capital letters, which translators leave unchanged) are kept.

Codec Conversions Aliases Comment
galactic text <-> Minecraft enchantment symbols galactic-alphabet, minecraft_enchantment, minecraft-enchanting-language case-insensitive when encoding
>>> codext.encode("this is a test", "galactic")
'ℸ ̣ ⍑╎ᓭ ╎ᓭ ᔑ ℸ ̣ ᒷᓭℸ ̣ '
>>> codext.decode("T⍑ᒷ ᑑ⚍╎ᓵꖌ ʖ∷𝙹∴リ ⎓𝙹 ̇/ ⋮⚍ᒲ!¡ᓭ 𝙹⍊ᒷ∷ ℸ ̣ ⍑ᒷ ꖎᔑ⨅|| ↸𝙹⊣.", "galactic")
'The quick brown fox jumps over the lazy dog.'

Ipsum

This implements a codec that uses lorem ipsum words. It selects random words per letter and keeps the following punctuations: ".,:;+=-*/\\".

Codec Conversions Aliases Comment
ipsum text <-> latin words loremipsum, lorem-ipsum words from the classical lorem ipsum
>>> codext.encode("This is a test.", "ipsum")
'Torquent hystericus id sit  interdum sit  aliquam  tempor erat scelerisque taciti.'
>>> codext.decode("Torquent hystericus id sit  interdum sit  aliquam  tempor erat scelerisque taciti.", "lorem-ipsum")
'This is a test.'

Leetspeak

This implements a very basic ruleset of elite speaking.

Codec Conversions Aliases Comment
leetspeak text <-> leetspeak encoded text leet, 1337, leetspeak based on minimalistic elite speaking rules
>>> codext.encode("this is a test", "leetspeak")
'7h15 15 4 7357'
>>> codext.decode("7h15 15 4 7357", "leetspeak")
'ThIS IS A TEST'

Morse

It supports of course letters and digits, but also a few special characters: .,;:?!/\\@&=-_'" $().

Codec Conversions Aliases Comment
morse text <-> morse encoded text none uses whitespace as a separator, dynamic tokens mapping ; we can define a mapping of encoding's tokens (original tokens: /-.)
>>> codext.encode("this is a test", "morse")
'- .... .. ... / .. ... / .- / - . ... -'
>>> codext.encode("this is a test", "morse/-.")
'- .... .. ... / .. ... / .- / - . ... -'
>>> codext.encode("this is a test", "morse_ABC")
'B CCCC CC CCC A CC CCC A CB A B C CCC B'
>>> codext.decode("- .... .. ... / .. ... / .- / - . ... -", "morse")
'this is a test'
>>> with codext.open("morse.txt", 'w', encoding="morse") as f:
    f.write("this is a test")
14
>>> with codext.open("morse.txt", encoding="morse") as f:
    f.read()
'this is a test'

It implements the letters from the Navajo Code Talkers' Dictionary. It conserves digits and newlines.

Codec Conversions Aliases Comment
navajo text <-> Navajo
>>> import codext
>>> codext.encode("this is a test 123", "navajo")
'a-woh cha tkin klesh - a-chi klesh - be-la-sana - a-woh dzeh klesh a-woh - 1 2 3'
>>> codext.decode("a-woh cha tkin klesh - a-chi klesh - be-la-sana - a-woh dzeh klesh a-woh - 1 2 3", "navajo")
'this is a test 123'

Radio Alphabet

This is also known as the NATO phonetic alphabet.

Codec Conversions Aliases Comment
radio text <-> radio alphabet words military_alphabet, nato-phonetic-alphabet, radio-alphabet
>>> codext.encode("foobar", "nato_phonetic_alphabet")
'Foxtrot Oscar Oscar Bravo Alpha Romeo'
>>> codext.decode("Foxtrot Oscar Oscar Bravo Alpha Romeo", "radio-alphabet")
'FOOBAR'

Southpark

This encodes text according to Kenny's language in Southpark.

Codec Conversions Aliases Comment
southpark text <-> Kenny's language kenny Dynamic tokens mapping ; we can define a mapping of encoding's tokens (original tokens: fFMmpP)
southpark-icase text <-> Kenny's language kenny_icase Dynamic tokens mapping ; we can define a mapping of encoding's tokens (original tokens: FMP)
>>> codext.encode("This is a Test", "southpark")
'FmpmfpmfffmmfffmfffmmfffmmmfffFmpmppfmmfmp'
>>> codext.decode('FmpmfpmfffmmfffmfffmmfffmmmfffFmpmppfmmfmp', "kenny")
'This is a Test'
>>> codext.encode("This is a test", "kenny_123456")
'245415411144111411144211444111145455144145'
>>> codext.decode("245415411144111411144211444111145455144145", "kenny-123456")
'This is a test'
>>> codext.encode("this is a test", "kenny_icase")
'FMPMFPMFFFMMFFFMFFFMMFFFMMMFFFFMPMPPFMMFMP'
>>> codext.decode("FMPMFPMFFFMMFFFMFFFMMFFFMMMFFFFMPMPPFMMFMP", "southpark-icase")
'this is a test'
>>> codext.encode("this is a test", "southpark-icase_123")
'123213211122111211122111222111123233122123'
>>> codext.decode('123213211122111211122111222111123233122123', "kenny_icase-123")
'this is a test'

Tap

This codec implements the tap/knock code commonly used by prisoners. Each letter is written as its row and column in a 5x5 Polybius square of 25 letters, "k" being encoded as "c". As with cryptii, the row and the column are separated by a space and the letters by two spaces ; words are separated by " / ".

When decoding, the dots are read in pairs whatever separates them (e.g. spaces, commas or the blank braille pattern written by former versions of this codec), a "/" giving a space.

Codec Conversions Aliases Comment
tap text <-> tap/knock encoded text knock, tap-code, tap-inv, ... -inv uses the reversed alphabet
>>> codext.encode("this is a test", "tap")
'.... ....  .. ...  .. ....  .... ... / .. ....  .... ... / . . / .... ....  . .....  .... ...  .... ....'
>>> codext.decode("..... .., . ., .... ...., . ....., .... ..", "knock")
'water'

Tom-Tom

This codec is similar to morse. It converts text into slashes and backslashes.

Codec Conversions Aliases Comment
tomtom text <-> tom-tom encoded text tom-tom uses "|" as a separator
>>> codext.encode("this is a test", "tom-tom")
'\\\\/\\ /\\\\ /\\\\\\ \\/\\ | /\\\\\\ \\/\\ | / | \\\\/\\ /\\ \\/\\ \\\\/\\'
>>> codext.decode("\\\\/\\ /\\\\ /\\\\\\ \\/\\ | /\\\\\\ \\/\\ | / | \\\\/\\ /\\ \\/\\ \\\\/\\", "tomtom")
'THIS IS A TEST'

Upside-down

Upside-down text (aka flip text) is written with Unicode characters that look like the letters, digits and punctuation turned by 180 degrees (e.g. ɐ for a, ꓭ for B or ¿ for ?), in reverse order, so that the text reads normally when turned upside down. As turning the text twice gives it back, encoding and decoding are the same operation.

Codec Conversions Aliases Comment
upsidedown text <-> upside-down text upside-down, flip-text other characters kept as is ; decoding also accepts other turned characters of the online generators (e.g. ∀ for A or ∩ for U)
>>> codext.encode("Hello World", "upsidedown")
'pꞁɹoM oꞁꞁǝH'
>>> codext.decode("pꞁɹoM oꞁꞁǝH", "upside-down")
'Hello World'