Crate zalgo_codec_common
source ·Expand description
A crate for converting an ASCII text string to a single unicode grapheme cluster and back.
Provides the non-macro functionality of the crate zalgo-codec
.
Features
files
(enabled by default) — Provides the functionsencode_file
,decode_file
, andwrap_python_file
Enums
- The error returned by the decoding functions that interact with the file system.
- The error returned by the encoding functions if they encounter a byte they can not encode.
- The error returned by the encoding functions that interact with the file system.
Functions
- Decodes the contents of a file that has been encoded with
encode_file
and stores the result in another file. - Encodes the contents of the file and stores the result in another file. If carriage return characters are found it will print a message and attempt to encode the file anyway by ignoring them.
- Encodes the contents of the given Python source file and stores the result wrapped in a decoder in another file. This new file retains the functionality of the original. If the source file contains carriage return characters this function will print a message and then attempt to encode it anyway by ignoring them.
- Takes in a string that was encoded by
zalgo_encode
and decodes it back into an ASCII string. - Takes in an ASCII string without control characters (except newlines) and “compresses” it to zalgo text using a reversible encoding scheme. The resulting string is a single unicode grapheme cluster and should only take up a single character space horizontally when displayed (though this can vary between platforms depending on how they deal with unicode). The resulting string will be ~2 times larger than the original in terms of bytes, and it can be decoded to recover the original string using
zalgo_decode
. - zalgo-encodes an ASCII string containing Python code and wraps it in a decoder that decodes and executes it. The resulting Python code should retain the functionality of the original.