quoted-printable

Code for Encode/Decode QuotedPrintable. [closed]

谁都会走 提交于 2021-02-18 11:55:07
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 6 years ago . Improve this question This method Encode your text to QuotedPrintable format public static string EncodeQuotedPrintable(string value) { if (string.IsNullOrEmpty(value)) return value; StringBuilder builder = new StringBuilder(); byte[] bytes = Encoding.UTF8.GetBytes(value); foreach (byte v in bytes)

Trailing equal signs (=) in emails

痞子三分冷 提交于 2021-01-28 00:30:55
问题 I download messages from a Gmail account using POP3 and save them in a SQLite database for futher processing: mailbox = poplib.POP3_SSL('pop.gmail.com', '995') mailbox.user(user) mailbox.pass_(password) msgnum = mailbox.stat()[0] for i in range(msgnum): msg = '\n'.join(mailbox.retr(i+1)[1]) save_message(msg, dbmgr) mailbox.quit() However, looking in the database, all lines but the last one of the message body (payload) have trailing equal signs. Do you know why this happens? 回答1: Frederic's

How to get Email in UTF-8?

折月煮酒 提交于 2021-01-27 12:19:57
问题 I am doing a Python script to get the mail sent by people on my email address. I am using the ImapClient module, and I got the content of the e-mail but prototyped strangely, all my UTF-8 Characters are encoded, like this : No=C3=ABl Here is my piece of code : email_message = email.message_from_bytes(message_data[b'RFC822']) print(email_message.get_payload(0)) I tried also to add the decode=True arguments in my get_payload , but it returns me a NoneType . 回答1: You would have to first identify

Stripping out unwanted characters that are breaking readline()

拥有回忆 提交于 2020-07-09 18:00:33
问题 I'm writing a small script to run through large folders of copyright notice emails and finding relevant information (IP and timestamp). I've already found ways around a few little formatting hurdles (sometimes IP and TS are on different lines, sometimes on same, sometimes in different places, timestamps come in 4 different formats, etc.). I ran into one weird problem where a few of the files I'm parsing through spew out weird characters in the middle of a line, ruining my parsing of readline(

Stripping out unwanted characters that are breaking readline()

落花浮王杯 提交于 2020-07-09 18:00:21
问题 I'm writing a small script to run through large folders of copyright notice emails and finding relevant information (IP and timestamp). I've already found ways around a few little formatting hurdles (sometimes IP and TS are on different lines, sometimes on same, sometimes in different places, timestamps come in 4 different formats, etc.). I ran into one weird problem where a few of the files I'm parsing through spew out weird characters in the middle of a line, ruining my parsing of readline(

Encoding issue : decode Quoted-Printable string in Python

别说谁变了你拦得住时间么 提交于 2020-07-03 03:24:08
问题 In Python, I got a string encoded in Quoted-Printable encoding mystring="=AC=E9" This string should be printed as é So I want to decode it and encode it in UTF-8, I guess. I understand that something is possible through import quopri quopri.decodestring('=A3=E9') But then, I'm completely lost. How would you do decode/encode this string to get printed properly? 回答1: import quopri Encoding: You can encode the character 'é' to Quoted-Printable using quopri.encodestring(). It takes a bytes object

What is “=C2=A0” in MIME encoded, quoted-printable text?

こ雲淡風輕ζ 提交于 2020-01-08 16:26:25
问题 This is an example raw email I am trying to parse: MIME-version: 1.0 Content-type: text/html; charset=UTF-8 Content-transfer-encoding: quoted-printable X-Mailer: Verizon Webmail X-Originating-IP: [x.x.x.x] =C2=A0test testing testing 123 What is =C2=A0? I have tried a half dozen quoted-printable parsers, but none handle this correctly. How would one properly parse this in C#? Honestly, for now, I'm coding: //TODO WTF encoded = encoded.Replace("=C2=A0", ""); Because I can't figure out why that

What is “=C2=A0” in MIME encoded, quoted-printable text?

蹲街弑〆低调 提交于 2020-01-08 16:23:26
问题 This is an example raw email I am trying to parse: MIME-version: 1.0 Content-type: text/html; charset=UTF-8 Content-transfer-encoding: quoted-printable X-Mailer: Verizon Webmail X-Originating-IP: [x.x.x.x] =C2=A0test testing testing 123 What is =C2=A0? I have tried a half dozen quoted-printable parsers, but none handle this correctly. How would one properly parse this in C#? Honestly, for now, I'm coding: //TODO WTF encoded = encoded.Replace("=C2=A0", ""); Because I can't figure out why that

Reading Text with Accent - Python

一笑奈何 提交于 2020-01-02 16:53:40
问题 I did some script in python that connects to GMAIL and print a email text... But, often my emails has words with "accent". And there is my problem... For example a text that I got: "PLANO DE S=C3=9ADE" should be printed as "PLANO DE SAÚDE". How can I turn legible my email text? What can I use to convert theses letters with accent? Thanks, The code suggested by Andrey, works fine on windows, but on Linux I still getting the wrong print: >>> b = 'PLANO DE S=C3=9ADE' >>> s = b.decode('quopri')

Reading Text with Accent - Python

半城伤御伤魂 提交于 2020-01-02 16:53:09
问题 I did some script in python that connects to GMAIL and print a email text... But, often my emails has words with "accent". And there is my problem... For example a text that I got: "PLANO DE S=C3=9ADE" should be printed as "PLANO DE SAÚDE". How can I turn legible my email text? What can I use to convert theses letters with accent? Thanks, The code suggested by Andrey, works fine on windows, but on Linux I still getting the wrong print: >>> b = 'PLANO DE S=C3=9ADE' >>> s = b.decode('quopri')