Function zalgo_codec_common::zalgo_decode
source · pub fn zalgo_decode(encoded: &str) -> Result<String, FromUtf8Error>
Expand description
Takes in a string that was encoded by zalgo_encode
and decodes it back into an ASCII string.
Returns an error if the decoded string is not valid UTF-8.
This can happen if the input is a string that was not encoded by zalgo_encode
,
since the byte manipulations that this function does could result in invalid unicode in that case.
If you want to be able to decode without this check, consider using a ZalgoString
.
Examples
assert_eq!(zalgo_decode("É̺͇͌͏").unwrap(), "Zalgo");
Decoding arbitrary strings will most likely lead to errors:
assert!(zalgo_decode("Shmårgl").is_err());