leahneukirchen / mblaze

Unix utilities to deal with Maildir
Other
441 stars 48 forks source link

Problems with special characters using mencrypt and mmime #167

Closed guillaumecherel closed 4 years ago

guillaumecherel commented 4 years ago

I've noticed that when I encrypt a message that contains special characters like à, é, send it to myself, and decrypt it, the characters don't display well anymore. Digging a bit, I see that when calling mmime on a message that contains such characters, they become unreadable (example below). How can I read them properly? Am I misunderstanding how mmime works?

The ultimate question is how can I read special characters properly when decoding an email that was encoded with mencrypt?

For example, with the following content in the file "msgtest":

To: bla@bla.com
Cc: 
Bcc: 
Subject: 
From: bla@bla.com
Message-Id: <1YHLB0BBH7E5S.3KT9KOOFC0R67@bla.fr>
User-Agent: mblaze/0.5.1-13-g1ed8a0a-dirty (2019-09-05)

accents: à é

The mmime command gives:

guillaume@guillaume-portable ~/tmp> mmime < msgtest
To: bla@bla.com
Cc:
Bcc:
Subject:
From: bla@bla.com
Message-Id: <1YHLB0BBH7E5S.3KT9KOOFC0R67@bla.fr>
User-Agent: mblaze/0.5.1-13-g1ed8a0a-dirty (2019-09-05)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----_=_462810cc62ddba987fdf34f3_=_"

This is a multipart message in MIME format.

------_=_462810cc62ddba987fdf34f3_=_
Content-Type: text/plain; charset=UTF-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

accents: =C3=A0 =C3=A9

------_=_462810cc62ddba987fdf34f3_=_--

Thanks

Duncaen commented 4 years ago

The mail client should decode it, the rfc for mails only allows ascii.

$ echo "\n\naccents: à é" | mmime | mshow /dev/stdin

--- 1: multipart/mixed size=259 ---
--- --- 2: text/plain size=16 ---

accents: à é
Duncaen commented 4 years ago

When the mail is encrypted and you want to use mshow to read it you need to add the mgpg filter to ~/.mblaze/filter: multipart/encrypted: mgpg.

$ mshow /tmp/test.gpg
From: mail@duncano.de

--- 1: multipart/encrypted size=2086 filter="mgpg" ---
--- --- 2: multipart/mixed size=720 ---
--- --- --- 3: text/plain size=15 ---
accents: à é

I think all other clients will work this way, decrypt the message and then decode the mime parts again.

guillaumecherel commented 4 years ago

Great, thanks for the explanation!