Skip to content

doctaphred/emojencode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

14 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

emojencode

What's it do?

    >>> import emojencode, textwrap
    >>> data = emojencode.e64encode(
    ...     b'Man is distinguished, not only by his reason, but by '
    ...     b'this singular passion from other animals, which is a '
    ...     b'lust of the mind, that by a perseverance of delight in '
    ...     b'the continued and indefatigable generation of knowledge, '
    ...     b'exceeds the short vehemence of any carnal pleasure.')
    >>> print('\n'.join(textwrap.wrap(data, 40)))
    ๐Ÿ˜“๐Ÿ˜–๐Ÿ˜…๐Ÿ˜ฎ๐Ÿ˜ˆ๐Ÿ˜†๐Ÿ˜ฅ๐Ÿ˜ณ๐Ÿ˜ˆ๐Ÿ˜†๐Ÿ˜‘๐Ÿ˜ฉ๐Ÿ˜œ๐Ÿ˜ท๐Ÿ˜‘๐Ÿ˜ฉ๐Ÿ˜›๐Ÿ˜ฆ๐Ÿ˜๐Ÿ˜ต๐Ÿ˜š๐Ÿ˜—๐Ÿ˜๐Ÿ˜จ๐Ÿ˜™๐Ÿ˜–๐Ÿ˜๐Ÿ˜ฌ๐Ÿ˜ˆ๐Ÿ˜†๐Ÿ˜น๐Ÿ˜ฏ๐Ÿ˜๐Ÿ˜‚๐Ÿ˜๐Ÿ˜ฏ๐Ÿ˜›๐Ÿ˜ฆ๐Ÿ˜ฑ๐Ÿ˜น
    ๐Ÿ˜ˆ๐Ÿ˜†๐Ÿ˜‰๐Ÿ˜น๐Ÿ˜ˆ๐Ÿ˜†๐Ÿ˜ก๐Ÿ˜ฉ๐Ÿ˜œ๐Ÿ˜ฒ๐Ÿ˜๐Ÿ˜ฒ๐Ÿ˜™๐Ÿ˜–๐Ÿ˜…๐Ÿ˜ณ๐Ÿ˜›๐Ÿ˜ถ๐Ÿ˜ธ๐Ÿ˜ฌ๐Ÿ˜ˆ๐Ÿ˜†๐Ÿ˜‰๐Ÿ˜ต๐Ÿ˜๐Ÿ˜‚๐Ÿ˜๐Ÿ˜ข๐Ÿ˜ž๐Ÿ˜’๐Ÿ˜๐Ÿ˜ด๐Ÿ˜š๐Ÿ˜†๐Ÿ˜ฅ๐Ÿ˜ณ๐Ÿ˜ˆ๐Ÿ˜‡๐Ÿ˜๐Ÿ˜ฉ
    ๐Ÿ˜›๐Ÿ˜ฆ๐Ÿ˜๐Ÿ˜ต๐Ÿ˜›๐Ÿ˜†๐Ÿ˜…๐Ÿ˜ฒ๐Ÿ˜ˆ๐Ÿ˜‡๐Ÿ˜๐Ÿ˜ก๐Ÿ˜œ๐Ÿ˜ท๐Ÿ˜๐Ÿ˜ฉ๐Ÿ˜›๐Ÿ˜ถ๐Ÿ˜ธ๐Ÿ˜ ๐Ÿ˜™๐Ÿ˜ง๐Ÿ˜‰๐Ÿ˜ฏ๐Ÿ˜›๐Ÿ˜’๐Ÿ˜๐Ÿ˜ฏ๐Ÿ˜๐Ÿ˜†๐Ÿ˜ก๐Ÿ˜ฅ๐Ÿ˜œ๐Ÿ˜ข๐Ÿ˜๐Ÿ˜ก๐Ÿ˜›๐Ÿ˜ฆ๐Ÿ˜ฅ๐Ÿ˜ญ
    ๐Ÿ˜˜๐Ÿ˜–๐Ÿ˜ฑ๐Ÿ˜ณ๐Ÿ˜‹๐Ÿ˜‚๐Ÿ˜๐Ÿ˜ท๐Ÿ˜š๐Ÿ˜†๐Ÿ˜ฅ๐Ÿ˜ฃ๐Ÿ˜š๐Ÿ˜‚๐Ÿ˜๐Ÿ˜ฉ๐Ÿ˜œ๐Ÿ˜ฒ๐Ÿ˜๐Ÿ˜ก๐Ÿ˜ˆ๐Ÿ˜†๐Ÿ˜ฑ๐Ÿ˜ต๐Ÿ˜œ๐Ÿ˜ท๐Ÿ˜๐Ÿ˜ ๐Ÿ˜›๐Ÿ˜ถ๐Ÿ˜˜๐Ÿ˜ ๐Ÿ˜๐Ÿ˜†๐Ÿ˜ก๐Ÿ˜ฅ๐Ÿ˜ˆ๐Ÿ˜†๐Ÿ˜ต๐Ÿ˜ฉ
    ๐Ÿ˜›๐Ÿ˜ฆ๐Ÿ˜๐Ÿ˜ฌ๐Ÿ˜ˆ๐Ÿ˜‡๐Ÿ˜‘๐Ÿ˜จ๐Ÿ˜˜๐Ÿ˜—๐Ÿ˜๐Ÿ˜ ๐Ÿ˜˜๐Ÿ˜ง๐Ÿ˜ค๐Ÿ˜ ๐Ÿ˜˜๐Ÿ˜’๐Ÿ˜๐Ÿ˜ฐ๐Ÿ˜™๐Ÿ˜—๐Ÿ˜‰๐Ÿ˜ณ๐Ÿ˜™๐Ÿ˜—๐Ÿ˜™๐Ÿ˜ฅ๐Ÿ˜œ๐Ÿ˜ฆ๐Ÿ˜…๐Ÿ˜ฎ๐Ÿ˜˜๐Ÿ˜ถ๐Ÿ˜”๐Ÿ˜ ๐Ÿ˜›๐Ÿ˜ถ๐Ÿ˜˜๐Ÿ˜ 
    ๐Ÿ˜™๐Ÿ˜†๐Ÿ˜•๐Ÿ˜ฌ๐Ÿ˜š๐Ÿ˜–๐Ÿ˜๐Ÿ˜จ๐Ÿ˜๐Ÿ˜‚๐Ÿ˜๐Ÿ˜ฉ๐Ÿ˜›๐Ÿ˜ข๐Ÿ˜๐Ÿ˜ด๐Ÿ˜š๐Ÿ˜†๐Ÿ˜”๐Ÿ˜ ๐Ÿ˜˜๐Ÿ˜ถ๐Ÿ˜ฝ๐Ÿ˜ฎ๐Ÿ˜๐Ÿ˜†๐Ÿ˜ฅ๐Ÿ˜ฎ๐Ÿ˜๐Ÿ˜–๐Ÿ˜•๐Ÿ˜ค๐Ÿ˜ˆ๐Ÿ˜†๐Ÿ˜…๐Ÿ˜ฎ๐Ÿ˜™๐Ÿ˜‚๐Ÿ˜๐Ÿ˜ฉ
    ๐Ÿ˜›๐Ÿ˜ฆ๐Ÿ˜‘๐Ÿ˜ฅ๐Ÿ˜™๐Ÿ˜ฆ๐Ÿ˜…๐Ÿ˜ด๐Ÿ˜š๐Ÿ˜–๐Ÿ˜๐Ÿ˜ก๐Ÿ˜˜๐Ÿ˜ฆ๐Ÿ˜ฑ๐Ÿ˜ฅ๐Ÿ˜ˆ๐Ÿ˜†๐Ÿ˜๐Ÿ˜ฅ๐Ÿ˜›๐Ÿ˜ฆ๐Ÿ˜•๐Ÿ˜ฒ๐Ÿ˜˜๐Ÿ˜—๐Ÿ˜‘๐Ÿ˜ฉ๐Ÿ˜›๐Ÿ˜ถ๐Ÿ˜ธ๐Ÿ˜ ๐Ÿ˜›๐Ÿ˜ถ๐Ÿ˜˜๐Ÿ˜ ๐Ÿ˜š๐Ÿ˜ถ๐Ÿ˜น๐Ÿ˜ฏ
    ๐Ÿ˜๐Ÿ˜ถ๐Ÿ˜ฑ๐Ÿ˜ฅ๐Ÿ˜™๐Ÿ˜†๐Ÿ˜๐Ÿ˜ฅ๐Ÿ˜‹๐Ÿ˜‚๐Ÿ˜๐Ÿ˜ฅ๐Ÿ˜ž๐Ÿ˜†๐Ÿ˜๐Ÿ˜ฅ๐Ÿ˜™๐Ÿ˜–๐Ÿ˜‘๐Ÿ˜ณ๐Ÿ˜ˆ๐Ÿ˜‡๐Ÿ˜‘๐Ÿ˜จ๐Ÿ˜™๐Ÿ˜’๐Ÿ˜๐Ÿ˜ณ๐Ÿ˜š๐Ÿ˜†๐Ÿ˜ฝ๐Ÿ˜ฒ๐Ÿ˜๐Ÿ˜‚๐Ÿ˜๐Ÿ˜ถ๐Ÿ˜™๐Ÿ˜–๐Ÿ˜ก๐Ÿ˜ฅ
    ๐Ÿ˜›๐Ÿ˜–๐Ÿ˜•๐Ÿ˜ฎ๐Ÿ˜˜๐Ÿ˜ถ๐Ÿ˜”๐Ÿ˜ ๐Ÿ˜›๐Ÿ˜ถ๐Ÿ˜˜๐Ÿ˜ ๐Ÿ˜˜๐Ÿ˜–๐Ÿ˜น๐Ÿ˜น๐Ÿ˜ˆ๐Ÿ˜†๐Ÿ˜๐Ÿ˜ก๐Ÿ˜œ๐Ÿ˜ฆ๐Ÿ˜น๐Ÿ˜ก๐Ÿ˜›๐Ÿ˜‚๐Ÿ˜๐Ÿ˜ฐ๐Ÿ˜›๐Ÿ˜†๐Ÿ˜•๐Ÿ˜ก๐Ÿ˜œ๐Ÿ˜ท๐Ÿ˜•๐Ÿ˜ฒ๐Ÿ˜™๐Ÿ˜’๐Ÿ˜ธ๐Ÿ’ฉ

Also this:

    >>> text = emojencode.e64decode('''
    ...     ๐Ÿ˜“๐Ÿ˜–๐Ÿ˜…๐Ÿ˜ฎ๐Ÿ˜ˆ๐Ÿ˜†๐Ÿ˜ฅ๐Ÿ˜ณ๐Ÿ˜ˆ๐Ÿ˜†๐Ÿ˜‘๐Ÿ˜ฉ๐Ÿ˜œ๐Ÿ˜ท๐Ÿ˜‘๐Ÿ˜ฉ๐Ÿ˜›๐Ÿ˜ฆ๐Ÿ˜๐Ÿ˜ต๐Ÿ˜š๐Ÿ˜—๐Ÿ˜๐Ÿ˜จ๐Ÿ˜™๐Ÿ˜–๐Ÿ˜๐Ÿ˜ฌ๐Ÿ˜ˆ๐Ÿ˜†๐Ÿ˜น๐Ÿ˜ฏ
    ...     ๐Ÿ˜๐Ÿ˜‚๐Ÿ˜๐Ÿ˜ฏ๐Ÿ˜›๐Ÿ˜ฆ๐Ÿ˜ฑ๐Ÿ˜น๐Ÿ˜ˆ๐Ÿ˜†๐Ÿ˜‰๐Ÿ˜น๐Ÿ˜ˆ๐Ÿ˜†๐Ÿ˜ก๐Ÿ˜ฉ๐Ÿ˜œ๐Ÿ˜ฒ๐Ÿ˜๐Ÿ˜ฒ๐Ÿ˜™๐Ÿ˜–๐Ÿ˜…๐Ÿ˜ณ๐Ÿ˜›๐Ÿ˜ถ๐Ÿ˜ธ๐Ÿ˜ฌ๐Ÿ˜ˆ๐Ÿ˜†๐Ÿ˜‰๐Ÿ˜ต
    ...     ๐Ÿ˜๐Ÿ˜‚๐Ÿ˜๐Ÿ˜ข๐Ÿ˜ž๐Ÿ˜’๐Ÿ˜๐Ÿ˜ด๐Ÿ˜š๐Ÿ˜†๐Ÿ˜ฅ๐Ÿ˜ณ๐Ÿ˜ˆ๐Ÿ˜‡๐Ÿ˜๐Ÿ˜ฉ๐Ÿ˜›๐Ÿ˜ฆ๐Ÿ˜๐Ÿ˜ต๐Ÿ˜›๐Ÿ˜†๐Ÿ˜…๐Ÿ˜ฒ๐Ÿ˜ˆ๐Ÿ˜‡๐Ÿ˜๐Ÿ˜ก๐Ÿ˜œ๐Ÿ˜ท๐Ÿ˜๐Ÿ˜ฉ
    ...     ๐Ÿ˜›๐Ÿ˜ถ๐Ÿ˜ธ๐Ÿ˜ ๐Ÿ˜™๐Ÿ˜ง๐Ÿ˜‰๐Ÿ˜ฏ๐Ÿ˜›๐Ÿ˜’๐Ÿ˜๐Ÿ˜ฏ๐Ÿ˜๐Ÿ˜†๐Ÿ˜ก๐Ÿ˜ฅ๐Ÿ˜œ๐Ÿ˜ข๐Ÿ˜๐Ÿ˜ก๐Ÿ˜›๐Ÿ˜ฆ๐Ÿ˜ฅ๐Ÿ˜ญ๐Ÿ˜˜๐Ÿ˜–๐Ÿ˜ฑ๐Ÿ˜ณ๐Ÿ˜‹๐Ÿ˜‚๐Ÿ˜๐Ÿ˜ท
    ...     ๐Ÿ˜š๐Ÿ˜†๐Ÿ˜ฅ๐Ÿ˜ฃ๐Ÿ˜š๐Ÿ˜‚๐Ÿ˜๐Ÿ˜ฉ๐Ÿ˜œ๐Ÿ˜ฒ๐Ÿ˜๐Ÿ˜ก๐Ÿ˜ˆ๐Ÿ˜†๐Ÿ˜ฑ๐Ÿ˜ต๐Ÿ˜œ๐Ÿ˜ท๐Ÿ˜๐Ÿ˜ ๐Ÿ˜›๐Ÿ˜ถ๐Ÿ˜˜๐Ÿ˜ ๐Ÿ˜๐Ÿ˜†๐Ÿ˜ก๐Ÿ˜ฅ๐Ÿ˜ˆ๐Ÿ˜†๐Ÿ˜ต๐Ÿ˜ฉ
    ...     ๐Ÿ˜›๐Ÿ˜ฆ๐Ÿ˜๐Ÿ˜ฌ๐Ÿ˜ˆ๐Ÿ˜‡๐Ÿ˜‘๐Ÿ˜จ๐Ÿ˜˜๐Ÿ˜—๐Ÿ˜๐Ÿ˜ ๐Ÿ˜˜๐Ÿ˜ง๐Ÿ˜ค๐Ÿ˜ ๐Ÿ˜˜๐Ÿ˜’๐Ÿ˜๐Ÿ˜ฐ๐Ÿ˜™๐Ÿ˜—๐Ÿ˜‰๐Ÿ˜ณ๐Ÿ˜™๐Ÿ˜—๐Ÿ˜™๐Ÿ˜ฅ๐Ÿ˜œ๐Ÿ˜ฆ๐Ÿ˜…๐Ÿ˜ฎ
    ...     ๐Ÿ˜˜๐Ÿ˜ถ๐Ÿ˜”๐Ÿ˜ ๐Ÿ˜›๐Ÿ˜ถ๐Ÿ˜˜๐Ÿ˜ ๐Ÿ˜™๐Ÿ˜†๐Ÿ˜•๐Ÿ˜ฌ๐Ÿ˜š๐Ÿ˜–๐Ÿ˜๐Ÿ˜จ๐Ÿ˜๐Ÿ˜‚๐Ÿ˜๐Ÿ˜ฉ๐Ÿ˜›๐Ÿ˜ข๐Ÿ˜๐Ÿ˜ด๐Ÿ˜š๐Ÿ˜†๐Ÿ˜”๐Ÿ˜ ๐Ÿ˜˜๐Ÿ˜ถ๐Ÿ˜ฝ๐Ÿ˜ฎ
    ...     ๐Ÿ˜๐Ÿ˜†๐Ÿ˜ฅ๐Ÿ˜ฎ๐Ÿ˜๐Ÿ˜–๐Ÿ˜•๐Ÿ˜ค๐Ÿ˜ˆ๐Ÿ˜†๐Ÿ˜…๐Ÿ˜ฎ๐Ÿ˜™๐Ÿ˜‚๐Ÿ˜๐Ÿ˜ฉ๐Ÿ˜›๐Ÿ˜ฆ๐Ÿ˜‘๐Ÿ˜ฅ๐Ÿ˜™๐Ÿ˜ฆ๐Ÿ˜…๐Ÿ˜ด๐Ÿ˜š๐Ÿ˜–๐Ÿ˜๐Ÿ˜ก๐Ÿ˜˜๐Ÿ˜ฆ๐Ÿ˜ฑ๐Ÿ˜ฅ
    ...     ๐Ÿ˜ˆ๐Ÿ˜†๐Ÿ˜๐Ÿ˜ฅ๐Ÿ˜›๐Ÿ˜ฆ๐Ÿ˜•๐Ÿ˜ฒ๐Ÿ˜˜๐Ÿ˜—๐Ÿ˜‘๐Ÿ˜ฉ๐Ÿ˜›๐Ÿ˜ถ๐Ÿ˜ธ๐Ÿ˜ ๐Ÿ˜›๐Ÿ˜ถ๐Ÿ˜˜๐Ÿ˜ ๐Ÿ˜š๐Ÿ˜ถ๐Ÿ˜น๐Ÿ˜ฏ๐Ÿ˜๐Ÿ˜ถ๐Ÿ˜ฑ๐Ÿ˜ฅ๐Ÿ˜™๐Ÿ˜†๐Ÿ˜๐Ÿ˜ฅ
    ...     ๐Ÿ˜‹๐Ÿ˜‚๐Ÿ˜๐Ÿ˜ฅ๐Ÿ˜ž๐Ÿ˜†๐Ÿ˜๐Ÿ˜ฅ๐Ÿ˜™๐Ÿ˜–๐Ÿ˜‘๐Ÿ˜ณ๐Ÿ˜ˆ๐Ÿ˜‡๐Ÿ˜‘๐Ÿ˜จ๐Ÿ˜™๐Ÿ˜’๐Ÿ˜๐Ÿ˜ณ๐Ÿ˜š๐Ÿ˜†๐Ÿ˜ฝ๐Ÿ˜ฒ๐Ÿ˜๐Ÿ˜‚๐Ÿ˜๐Ÿ˜ถ๐Ÿ˜™๐Ÿ˜–๐Ÿ˜ก๐Ÿ˜ฅ
    ...     ๐Ÿ˜›๐Ÿ˜–๐Ÿ˜•๐Ÿ˜ฎ๐Ÿ˜˜๐Ÿ˜ถ๐Ÿ˜”๐Ÿ˜ ๐Ÿ˜›๐Ÿ˜ถ๐Ÿ˜˜๐Ÿ˜ ๐Ÿ˜˜๐Ÿ˜–๐Ÿ˜น๐Ÿ˜น๐Ÿ˜ˆ๐Ÿ˜†๐Ÿ˜๐Ÿ˜ก๐Ÿ˜œ๐Ÿ˜ฆ๐Ÿ˜น๐Ÿ˜ก๐Ÿ˜›๐Ÿ˜‚๐Ÿ˜๐Ÿ˜ฐ๐Ÿ˜›๐Ÿ˜†๐Ÿ˜•๐Ÿ˜ก
    ...     ๐Ÿ˜œ๐Ÿ˜ท๐Ÿ˜•๐Ÿ˜ฒ๐Ÿ˜™๐Ÿ˜’๐Ÿ˜ธ๐Ÿ’ฉ
    ... ''')
    >>> textwrap.shorten(text.decode('utf-8'), width=55, placeholder='...')
    'Man is distinguished, not only by his reason, but by...'

Installation

pip3 install emojencode

Requires Python 3.

Console script usage

emojencode [<data>]
emojdecode [<data>]

If data is not provided, reads from stdin.

When decoding, any unrecognized characters are ignored.

Example usage:

$ emojencode 'Hello, ๐ŸŒŽ!' > message.e64
$ cat message.e64
๐Ÿ˜’๐Ÿ˜†๐Ÿ˜•๐Ÿ˜ฌ๐Ÿ˜›๐Ÿ˜†๐Ÿ˜ผ๐Ÿ˜ฌ๐Ÿ˜ˆ๐Ÿ˜๐Ÿ˜‚๐Ÿ˜Ÿ๐Ÿ˜ฃ๐Ÿ˜ˆ๐Ÿ˜ธ๐Ÿ˜ก
$ cat message.e64 | emojdecode
Hello, ๐ŸŒŽ!

Advanced usage:

$ emojdecode '
> cant belive how #blessed i am with such an
> awesome life โค๐Ÿ˜š๐Ÿ˜’๐Ÿ˜๐Ÿ˜ญ๐Ÿ˜ˆ๐Ÿ˜‡๐Ÿ˜๐Ÿ˜ฏ๐Ÿ˜ˆ๐Ÿ˜†๐Ÿ˜…๐Ÿ˜ฌ๐Ÿ˜›๐Ÿ˜ถ๐Ÿ˜น๐Ÿ˜ฅ
> #weareyoung #lol #yolo
> '
i'm so alone

License

emojdecode "$(curl -fsSL https://raw.githubusercontent.com/doctaphred/emojencode/master/LICENSE)"

To Do

  • more emoji
  • gzip + ascii85 support
  • cowsay integration