Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Emoji to UTF-8 converter

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 :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading