4 ms·
Rather than trying to write your own quoted printable decoder, why not use a library? E.g in python it would just look like: quopri.decodestring(message_so
by axiak 10y ago
Rather than trying to write your own quoted printable decoder, why not use a library? E.g in python it would just look like:
quopri.decodestring(message_source)
- morrbo 10y agohonestly? because i didn't know the encoding was called quoted printable, lol. I wish I had have known that at the time as it would have saved me a lot of hassle. I'm going to go back now and use a library, as my guessing-at-the-html is probably wrong. Edit: a quick cursory google shows http://www.dpit.co.uk/decoding-quoted-printable-email-in-c/ http://www.dpit.co.uk/decoding-quoted-printable-email-in-c/ as a good enough solution for C#. I feel kind of stupid now, but had honestly never heard of QP encoding before.
- egwynn 10y agoI feel your pain. This is something that I learned on-the-fly as well. I encourage you to read up on the MIME specs to flesh out your understanding of “common things that show up inside emails”. https://en.wikipedia.org/wiki/MIME https://en.wikipedia.org/wiki/MIME is a good starting point, because there are umpteen relevant RFCs.
- justinator 10y agoquoted-printable is used to encode email messages quite a (7)bit :) Take a look of the source of most any HTML-formatted email. In my experience, it's the only way to keep content of an unknown character set and highly diverse content from getting corrupted when going through processing stages (for email). A lot of the tools to manipulate an email message can (also) be destructive. Email is weird. I can see why they'd use it for this service, if the original email was also a part of the notification they're sending.
- disiplus 10y agoalternative is to use base64. some things you learn when you have to deal with emails. also first time i was sending sms messages and not using ascii trying to determinate the message length was fun. and by fun i mean gsm 7bit annoying.
- justinator 10y agoI wouldn't suggest base64 encoding for messages that are mostly text (plaintext, html messages), but it's just dandy for attachments. Debugging something in an email message encoding in quoted-printable simply by viewing its source is doable sometimes. If it's in base64, not so much. I believe the size of your message would also be less using quoted-printable, rather than base64