سؤال

I want to know how to write the unicode Emoji characters in this form "xn--ls8h" <-- that is the pile of poo emoji unicode character. I had never seen this form, always something like &#5623*; (no asterisk) or something like that... What is this "xn--" form and how do I convert to it? Thanks!

هل كانت مفيدة؟

المحلول

xn-- is the prefix used in the ASCII representation of an Internationalized Domain Name, and ls8h is the Punycode representation of the character.

In Python, Punycode is one of the standard character encodings:

>>> b'ls8h'.decode('punycode')
'\U0001f4a9'
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top