Apple mail corrupts incoming attachment file names, when not ASCII (question marks)
Seems like this has been a problem forever, with some posts from more than 10 years ago.
When downloading attachments from gmail in macOS's Mail app, the filename is incorrectly parsed which results in unreadable filename with question marks.
For example, in a recent mail with an attachment, if viewing raw mail message from the app, the chunk with the attachment has the filename clearly set as UTF-8:
--000000000000a5b9f405d3f2184e
Content-Type: application/pdf; name="=?UTF-8?B?16fXkdec15Rf16LXnF/Xqteo15XXnteUXzEwNw==?=
=?UTF-8?B?NjQ5LnBkZg==?="
Content-Disposition: attachment;
filename="=?UTF-8?B?16fXkdec15Rf16LXnF/Xqteo15XXnteUXzEwNzY0OS5wZGY=?="
Content-Transfer-Encoding: base64
...
Decoding b64 "16fXkdec15Rf16LXnF/Xqteo15XXnteUXzEwNzY0OS5wZGY=" (in UTF-8) results in "קבלה_על_תרומה_107649.pdf" which is how the filename is displayed in gmail on the web, or through other app clients. However, Apple Mail gets it as "????_? ?_???? ?_107649.pdf"
I don't understand why this hasn't been fixed in the Mail app when it seems to be somewhat maintained.
Mac mini, macOS 12.1