I'm trying to add contacts to Sendgrid from a db which occasionally is storing the user email in punycode example-email@xn--yaho-sqa.com
which translates to example-email@yahóo.com
in Unicode.
Anyway if I try and add the ascii version there's an error because sendgrid doesn't accept it - however it does accept the Unicode version.
So is there a way to convert them in python.
So I think long story short is there a way to decode punycode to Unicode?
Edit
As suggested in comments i tried
'example-email@yahóo.com'.encode('punycode').decode()
which returns example-email@yaho.com-cgc
so this is incorrect outside of python so is not a valid solution.
Thanks in advance.