diff --git a/text_codecs/hello.txt b/text_codecs/hello.txt new file mode 100644 index 0000000..05a682b --- /dev/null +++ b/text_codecs/hello.txt @@ -0,0 +1 @@ +Hello! \ No newline at end of file diff --git a/text_codecs/mycodec.py b/text_codecs/mycodec.py index e4be94e..fab00e9 100644 --- a/text_codecs/mycodec.py +++ b/text_codecs/mycodec.py @@ -1,12 +1,18 @@ -"This simple codec converts all text to Lowercase." +from register import register_codec def encode(text): text = text.lower() - return text.encode("utf-8") + result = "" + + for char in text: + if char.isalpha() or char == " ": + if char not in "aeiou": + result += char + + return result.encode("utf8") def decode(data): - return bytes(data).decode("utf-8").lower() - -from register import register_codec -register_codec(encode, decode, "mycodec") + text = bytes(data).decode("utf8") + return text +register_codec(encode, decode, "mycodec") \ No newline at end of file