Change “Quoted-printable” encoding to “utf-8”

后端 未结 1 1778
别那么骄傲
别那么骄傲 2020-12-09 06:00

I am trying to read email with imaplib. I get this mail body:

=C4=EE=E1=F0=FB=E9 =E4=E5=ED=FC!  

That is Quoted-printable enco

相关标签:
1条回答
  • 2020-12-09 06:14

    The quopri module can convert those bytes to an unencoded byte stream. You need to then decode those from whatever character set they're in, then encode back to utf-8.

    >>> b = quopri.decodestring('=C4=EE=E1=F0=FB=E9 =E4=E5=ED=FC')
    >>> print(b.decode('windows-1251'))
    Добрый день
    
    0 讨论(0)
提交回复
热议问题