Emoji to UTF-8 converter

Advertisements

How can I convert this string in python3 '👀🥶' into this '%F0%9F%91%80%F0%9F%A5%B6' ? Would like to do this with any emojis

>Solution :

If percentage encoding is what you are after, urllib module in Python could help.

Ref: https://docs.python.org/3/library/urllib.parse.html#urllib.parse.quote

Python 3:

text = '👀🥶'
import urllib.parse
print(urllib.parse.quote(text))

Returns

%F0%9F%91%80%F0%9F%A5%B6

Leave a ReplyCancel reply