jhillyerd / enmime

MIME mail encoding and decoding package for Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why force ASCII for filename when the mime.FormatMediaType will encode the filename properly

vertazzar opened this issue · comments

setParamValue(param, hpName, stringutil.ToASCII(p.FileName))

Forcing ascii should not be done here because mime.FormatMediaType will do the necessary encoding.

Unless you found some issues with mime.FormatMediaType ?

It seems in 2018 FormatMediaType did not do what we wanted, see #55

You could try removing it and see how it affects the unit tests.

Do you have a concrete example of how this is causing a problem? Not sure what to do with issue.

Hello, sorry for the delay - had a very busy week. I've noticed that for example filename: "Field one two three žplpšž (2).xls"

becomes filename*=utf-8''Field%20one%20two%20three%20z%CC%8Cplps%CC%8Cz%CC%8C%20%281%29.xls

Which is what I've been looking for. E-mail clients understand this notation and filename is then displayed correctly. See: https://stackoverflow.com/a/216777/376238

EDIT: I know this stack overflow link refers to HTTP headers but generally this notation I've also seen in e-mails. I'll have to additionally check the RFC for e-mail headers, but I simply didn't have time

new release fix the issue.
But it is failing on file names when it has semicolon (;) in it. Like abc;xyz.xml, abc;.doc etc.
So pls solve that as well

Closing in favor of #174 given primary issue is fixed.