emersion / go-imap

📥 An IMAP library for clients and servers
MIT License
2.1k stars 297 forks source link

v2: `Envelope.Subject` sometimes gets `=?` encoded data #528

Closed Vovan-VE closed 1 year ago

Vovan-VE commented 1 year ago

2.0.0-alpha.4

Using imapclient to fetch messages, Envelope.Subject sometimes returns encoded subject like:

=?koi8-r?B?UkU6IPrE0sHX09TX1crUxS4=?=

instead of RE: Здравствуйте. in this example. Exact conditions are unknown yet, unfortunely, because it's very rare.

The same messages in the same app instance parsed with github.com/emersion/go-message/mail CreateReader()... have correct results. Charsets are imported:

import _ "github.com/emersion/go-message/charset"
emersion commented 1 year ago

Do you also set imapclient.Options.WordDecoder to &mime.WordDecoder{CharsetReader: message.CharsetReader}?

This is probably something which should be added to the docs or the wiki.

Vovan-VE commented 1 year ago

No, didn't discover it yet. I'll try, thanks.

Vovan-VE commented 1 year ago

It looks like WordDecoder helped. Thanks!