0

How can I decode the javascript code back to the ghost emoji in python

I tried putting that directly in print, but yeah did not work

tried even:

import emoji
print(emoji.emojize("\uD83D\uDC7B"))

both resulting in:

UnicodeEncodeError: 'utf-8' codec can't encode characters in position 0-1: surrogates not allowed
Pranav Hosangadi
  • 23,755
  • 7
  • 44
  • 70
NinjaRide
  • 3
  • 3

1 Answers1

0

You can use the str.encode method to get this, as this is a surrogate pair, you might want to try:

"\ud83d\udc7b".encode("utf-16", "surrogatepass").decode("utf-16")

You will need a terminal that supports this.

xihtyM
  • 240
  • 1
  • 2
  • 9