Encode a byte buffer into emojis, and decode an emoji string into a byte vector.
Reimplementation of base_emoji
including both
encoding and decoding.
let bytes = [0x6e, 0x6e, 0x6e, 0xcd];
let emojis = "🔥🔥🔥🚀";
assert_eq!(encoji::to_string(&bytes), emojis);
assert_eq!(encoji::from_string(&emojis)[..], bytes);
Citing the README:
The emojis used are in
emojis.json
. There are 843 emojis there, but the converter reads sequences of 8 bits at a time, and so only maps the value to the first 256 of them. To stay consistent with other renderings, make sure you don't change the order of your emojis.json.
String is split into graphemes by the
unicode-segmentation
crate in accordance
with the Unicode Standard Annex #29. If the grapheme
isn't a mappable emoji it is skipped, else it is converted to a byte.
MIT. See included LICENSE
file.