I'm writing app in Golang. I need to decode email subject.
Original subject:
Raport z eksportu ogłoszeń nieruchomości
Encoded subject:
=?utf-8?B?RG9tLmV1IC0gcmFwb3J0IHogZWtzcG9ydHUgb2fFgm9zemXF?= =?utf-8?B?hCBuaWVydWNob21vxZtjaQ==?=^M
Decoded subject: "Raport z eksportu ogłosze▒ ▒ nieruchomości"
I use github.com/famz/RFC2047 to decode email subjects.
My code is simple:
RFC2047.Decode(msg.Header.Get("Subject"))
Why, after decoding the subject is broken? Other subjects are correctly decoded. Is this a bad encoded subject?
That subject is incorrectly encoded.
It was broken into two MIME encoded-words (because the encoded line would be longer than 76 characters), but it was split in the middle of the ń
character.
If you join the two parts into a single encoded string, you get back the original subject:
s := "=?utf-8?B?RG9tLmV1IC0gcmFwb3J0IHogZWtzcG9ydHUgb2fFgm9zemXFhCBuaWVydWNob21vxZtjaQ==?="
fmt.Println(RFC2047.Decode(s))
// Dom.eu - raport z eksportu ogłoszeń nieruchomości
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With