You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is fine for inline parts, but it's not good for attachment parts, because:
When text attachment charset decoded successfully, there is a confusion: body is in UTF-8, and charset param is the original charset name still.
In case of broken/malformed email generated by sender, here comes data corruption (lots of \uFFFD). This case can be solved only by replacing entire input io.Reader before passing to your Reader.
Contrete example
A broken email generated by 4th-party software having an attachment in form of 3rd-party proprietary format (text/plain; charset=windows-1251 being blamed and damned uncountable number of times in tens years), but wrong charset ANSI_X3.4-1968 is used instead of actual windows-1251:
Content-Type: multipart/mixed; boundary=qqq
--qqq
Content-Type: text/plain; charset=UTF-8
Bla-bla-bla
--qqq
Content-Type: text/plain; charset=ANSI_X3.4-1968; name=123.txt
Content-Disposition: attachment; filename=123.txt
Actually content is in windows-1251 and will be corrupted by mail Reader.
--qqq--
Feature Request
Please, introduce an option in any form (for example package exported variable) to disable charset conversion for attachment text parts. Keep the option default state in backward compatible value.
The text was updated successfully, but these errors were encountered:
Hello!
When a text attachments are presented in a different charset, this code fragment converts all of such attachments.
go-message/entity.go
Lines 48 to 57 in f7e55c4
This is fine for
inline
parts, but it's not good forattachment
parts, because:charset
param is the original charset name still.\uFFFD
). This case can be solved only by replacing entire inputio.Reader
before passing to your Reader.Contrete example
A broken email generated by 4th-party software having an attachment in form of 3rd-party proprietary format (
text/plain; charset=windows-1251
being blamed and damned uncountable number of times in tens years), but wrong charsetANSI_X3.4-1968
is used instead of actualwindows-1251
:Feature Request
Please, introduce an option in any form (for example package exported variable) to disable charset conversion for
attachment
text parts. Keep the option default state in backward compatible value.The text was updated successfully, but these errors were encountered: