I use imaplib to retrieve email themes from Gmail, and some of them look like this:
imaplib
=?utf-8?Q?12_=D7=A1=D7=91=D7=99=D7=97?=
How can I decode this representation into plain Unicode text?
Thanks in advance!
Your string is encoded in Quoted-printable format for MIME headers. The email.header module handles this for you:
email.header
>>> from email.header import decode_header >>> for part in decode_header('=?utf-8?Q?12_=D7=A1=D7=91=D7=99=D7=97?='): ... print(str(*part)) 12 סביח
Source: https://habr.com/ru/post/1435464/More articles:fgets (): Ok on the console, Bad pipe - cIn Objective-C, how do you mark a critical region? - multithreadingRedirecting to google or any other website using magento - phpHow to check the use of conditional definitions if the application is Firemonkey one? - cross-platformAutomatically copy files without overwriting, but create numbered files instead - vbscriptConditionally compile units for FMX or VCL - compiler-constructionCurtose function in the image - statisticsAndroid Phone Call Flow - javaEntityManager getReference non lazy loading - eclipseError with RegOpenKeyEx () - c ++All Articles