wono on Nostr: /run py def encode_secret_emoji(emoji: str, text: str) -> str: """Encode text to ...
/run py
def encode_secret_emoji(emoji: str, text: str) -> str:
"""Encode text to Secret Emoji"""
VS_START = 0xfe00
VS_SUPP_START = 0xe0100
utf8_bytes = text.encode('utf-8')
result = []
for byte in utf8_bytes:
if byte <= 15:
cp = VS_START + byte
else:
cp = VS_SUPP_START + byte - 16
result.append(chr(cp))
return emoji + ''.join(result)
def decode_secret_emoji(text: str) -> str:
"""Decode Secret Emoji to text"""
VS_START, VS_END = 0xfe00, 0xfe0f
VS_SUPP_START, VS_SUPP_END = 0xe0100, 0xe01ef
decoded = []
i = 0
while i < len(text):
cp = ord(text[i])
if 0xD800 <= cp <= 0xDBFF and i + 1 < len(text):
low = ord(text[i + 1])
if 0xDC00 <= low <= 0xDFFF:
cp = 0x10000 + ((cp - 0xD800) << 10) + (low - 0xDC00)
i += 2
else:
i += 1
continue
else:
i += 1
if VS_START <= cp <= VS_END:
decoded.append(cp - VS_START)
elif VS_SUPP_START <= cp <= VS_SUPP_END:
decoded.append(cp - VS_SUPP_START + 16)
return bytes(decoded).decode('utf-8', errors='replace')
print(decode_secret_emoji("👙󠇓󠅳󠆆󠇓󠅳󠆙󠇠󠆏󠆕󠆏󠇣󠆐󠅷󠆃󠇣󠆐󠅵󠆡󠇣󠆐󠅵󠆪󠇣󠆐󠅷󠆃󠇣󠆐󠅵󠆡󠇣󠆐󠅶󠆃󠇣󠆐󠅷󠆃󠇣󠆐󠅵󠆡󠇣󠆐󠅶󠆑󠇣󠆐󠅷󠆃󠇣󠆐󠅵󠆡󠇣󠆐󠅵󠆤"))
Published at
2026-05-18 01:19:12 UTCEvent JSON
{
"id": "ab5ab04fa9b75ad1ca2611c94dd57b66aaef81c50689c929910644e8db74887b",
"pubkey": "6f849dc7387f4dc991af2360b5cbe61e9fc96170a096fa577c1b9177ca5882f5",
"created_at": 1779067152,
"kind": 1,
"tags": [
[
"client",
"Nostr Live Canvas",
"31990:73491509b8e2d80840873b5a13ba98a5d1ac3a16c9292e106b1f2eda31152c52:nostr-live-canvas",
"wss://relay.nostr.nisshiee.org"
]
],
"content": "/run py\n\ndef encode_secret_emoji(emoji: str, text: str) -\u003e str:\n \"\"\"Encode text to Secret Emoji\"\"\"\n VS_START = 0xfe00 \n VS_SUPP_START = 0xe0100 \n \n utf8_bytes = text.encode('utf-8')\n result = []\n\n for byte in utf8_bytes:\n \n if byte \u003c= 15:\n cp = VS_START + byte \n else:\n cp = VS_SUPP_START + byte - 16 \n result.append(chr(cp))\n\n return emoji + ''.join(result)\n\n\ndef decode_secret_emoji(text: str) -\u003e str:\n \"\"\"Decode Secret Emoji to text\"\"\"\n VS_START, VS_END = 0xfe00, 0xfe0f \n VS_SUPP_START, VS_SUPP_END = 0xe0100, 0xe01ef \n\n decoded = []\n i = 0\n\n while i \u003c len(text):\n cp = ord(text[i])\n\n if 0xD800 \u003c= cp \u003c= 0xDBFF and i + 1 \u003c len(text):\n low = ord(text[i + 1])\n if 0xDC00 \u003c= low \u003c= 0xDFFF:\n cp = 0x10000 + ((cp - 0xD800) \u003c\u003c 10) + (low - 0xDC00)\n i += 2\n else:\n i += 1\n continue\n else:\n i += 1\n\n if VS_START \u003c= cp \u003c= VS_END:\n decoded.append(cp - VS_START) \n elif VS_SUPP_START \u003c= cp \u003c= VS_SUPP_END:\n decoded.append(cp - VS_SUPP_START + 16) \n return bytes(decoded).decode('utf-8', errors='replace')\n\n\nprint(decode_secret_emoji(\"👙󠇓󠅳󠆆󠇓󠅳󠆙󠇠󠆏󠆕󠆏󠇣󠆐󠅷󠆃󠇣󠆐󠅵󠆡󠇣󠆐󠅵󠆪󠇣󠆐󠅷󠆃󠇣󠆐󠅵󠆡󠇣󠆐󠅶󠆃󠇣󠆐󠅷󠆃󠇣󠆐󠅵󠆡󠇣󠆐󠅶󠆑󠇣󠆐󠅷󠆃󠇣󠆐󠅵󠆡󠇣󠆐󠅵󠆤\"))",
"sig": "52a9948dab9e758b36f1eddf67c003de9553726ed8e4c122c40991eb76ac313fc732e6c595791c153f653a91b504176d88955c870aeddbf1e95c02299bb8ad6e"
}