简体   繁体   中英

Python : encode string

I'd like sending a message (an e-mail) which contains strings from a database with some special characters

Example (in french): "Bonjour ça va ?"

Is it possible to encode the mail to utf-8 mode ? When I write this message on a file, I just have to set his property to "utf-8" and then he displays it successfully, how can do the same thing into my mail?

你试过了吗?:

u"Bonjour ça va ?"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM