mu icon indicating copy to clipboard operation
mu copied to clipboard

Encoding issue for some types of emails

Open bderembl opened this issue 1 year ago • 10 comments

Steps to reproduce:

Enter Compose mode write an email to yourself with Subject: tést body: tést

send it so far so good. I receive the email, all is fine(*).

Now, jump in Sent Folder and select the email you just sent W (reply to all)

in this newly created reply, the subject appears as

Subject: Re: t\303\251st image

If I try to send the email, I get the warning

Non-Printable characters found. Continue sending?

I can still send it but I receive an email with a messed up subject

Here is the raw email in the "Sent folder"


From: BD <bruno@...>
To: BD <bruno@...>
Subject: tést
Date: Wed, 03 Jul 2024 09:12:18 +0200
Message-ID: <87tth7q78t.fsf@...>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: base64

dMOpc3QNCg==

(*)Sidenote: I can even reply to this first email that I just received and in that case, everything is fine. The problem is only for the email that is stored in the sent folder

Environment

mu4e 1.12.5 emacs 29.3

Checklist

  • [x] you are running either an 1.10.x/1.12.x release or master (otherwise please upgrade)
  • [x] you can reproduce the problem without 3rd party extensions (including Doom/Evil, various extensions etc.)
  • [x] you have read all of the above

bderembl avatar Jul 03 '24 07:07 bderembl

Cannot reproduce. This is what I get:

From: "Dirk-Jan C. Binnema" <[email protected]>
To: Dirk-Jan C. Binnema <[email protected]>
Subject: =?utf-8?Q?t=C3=A9st?=
Date: Wed, 03 Jul 2024 23:08:45 +0300
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: base64

dMOpc3QNCg==

Seems to be some encoding issue.

Did you try with emacs -Q and only the barest minimal setup for mu4e?

djcb avatar Jul 03 '24 20:07 djcb

From what I see from your email, your subject is correctly encoded: Subject: =?utf-8?Q?t=C3=A9st?= while mine is not Subject: tést

Do you have any idea why?

bderembl avatar Jul 04 '24 08:07 bderembl

Yes, it's all correct here.

But, can you reproduce with a bare minimal mu4e? Use something like:

emacs -Q --eval "(progn (add-to-list 'load-path \"~/Sources/mu/build/mu4e\") (setq mu4e-mu-binary \"~/Sources/mu/build/mu/mu\") (require 'mu4e) (mu4e))"

(change the paths as necessary for your setup). Thanks.

djcb avatar Jul 04 '24 15:07 djcb

yes same problem. I need to proceed a bit differently in this case though because there is no context and mu4e is not configured to send an email.

with emacs -Q, I need to

-compose a mail with "tést" in subject, save it as a draft, select that draft, reply to all, same issue as described above.

bderembl avatar Jul 04 '24 19:07 bderembl

but I don't understand what you mean by " it's all correct here." since our subjects differ.

bderembl avatar Jul 04 '24 19:07 bderembl

"It's all correct here" means "When I try this, the subject is correctly encoded"

We need to find out why it's not at your side. I suspect this goes a bit beyond mu4e... can you try some of the suggestions here? https://emacs.stackexchange.com/questions/7946/using-utf8-encoding-as-default-when-writing-emails

djcb avatar Jul 06 '24 07:07 djcb

Thank you for your assistance. I have just tried all solutions proposed in your link but I get the same issue.

Could you clarify the sequence of events that happens when I save a mail as a draft?

In my case, the body of the message is correctly encoded but not the subject. Are these two elements treated separately?

bderembl avatar Jul 08 '24 09:07 bderembl

I just tested in 1.10.8 the draft email is saved as

User-agent: mu4e 1.10.8; emacs 29.3
From: BD <bruno@...>
To: BD <bruno@...>
Subject: tést
Date: Tue, 23 Jul 2024 14:46:45 +0200

tést

so no mention of UTF-8 anywhere. If I reply to this email, there is no issue: I get

Subject: Re: tést

so no issue at all.

bderembl avatar Jul 23 '24 14:07 bderembl

Hmm, I suspect it's something to do with the language-environment.

Can you to reproduce with something like:

LANG=en_US.UTF-8 emacs -Q --eval "(progn (add-to-list 'load-path \"~/Sources/mu/build/mu4e\") (setq mu4e-mu-binary \"~/Sources/mu/build/mu/mu\") (require 'mu4e) (mu4e))"

or alternatively, use UTF-8 for the language-enviroment in emacs M-x set-language-environment)

djcb avatar Dec 03 '24 20:12 djcb

Yes, I already have (set-language-environment "UTF-8")

bderembl avatar Dec 04 '24 09:12 bderembl