| Title: Read quoted-printable emails with qprint | |
| Author: Solène | |
| Date: 27 October 2023 | |
| Tags: openbsd linux unix | |
| Description: In this article, you will learn about quoted-printed | |
| encoding, and how to decode it with qprint | |
| # Introduction | |
| You may already have encountered emails in raw text that contained | |
| weird characters sequences like `=E3` or `=09`, especially if you work | |
| with patch files embedded as text in emails. | |
| There is nothing wrong with the text itself, or the sender email | |
| client. In fact, this shows the email client is doing the right thing | |
| by applying the RFC 1521. Non-ASCII character should be escaped in | |
| some way in emails. | |
| RFC 1521: MIME part one | |
| This is where qprint enters in action, it can be used to encode using | |
| the quoted-printable, or decode such content. The software can be | |
| installed on OpenBSD with the package named `qprint`. | |
| qprint official website | |
| I already introduced qprint in a blog post in a guide about OpenBSD | |
| pledge. | |
| # What does quoted-printable look like? | |
| If you search for an email from the OpenBSD mailing list, and display | |
| it in raw format, you may encounter this encoding. There isn't much | |
| you can do with the file, it's hard to read and can't be used with the | |
| program patch. | |
| Email example featuring quoted-printable characters | |
| A sample of the email looks like that: | |
| ``` | |
| From italiano-=E6=97=A5=E6=9C=AC=E8=AA=9E (=E3=81=AB=E3=81=BB=E3=82=93= | |
| =E3=81=94) FreeDict+WikDict dictionary ver. | |
| 2022.11.18 [itajpn]: | |
| =09 | |
| ciao //'=CA=A7ao// <interjection> | |
| =E3=81=93=E3=82=93=E3=81=AB=E3=81=A1=E3=81=AF | |
| =09 | |
| ``` | |
| If you pipe this content through the command `qprint -d`, you will | |
| obtain a much more interesting text: | |
| ``` | |
| From italiano-日本語 (にほんご) FreeDict+WikDict dictionary ver. | |
| 2022.11.18 [itajpn]: | |
| ciao //'ʧao// <interjection> | |
| こんにちは | |
| ``` | |
| There is little use in encoding content with qprint, but it could do it | |
| as well. | |
| # Conclusion | |
| If you ever encounter this kind of encoding, now you should be able to | |
| figure what it is, and how to read it. | |
| Qprint may not be available on all systems, but compiling it is quite | |
| easy, as long as you have a C compiler and make installed. |