from email.message import Message
from email.header import Header
msg = Message()
msg['Subject'] = Header('\xe4\xb8\xbb\xe9\xa1\x8c', 'utf-8')
print(msg.as_string())
Encoding mail subject (SMTP) in Python with non-ASCII characters