------------
This is a knowledge capture for customers using non-ASCII characters with attachments sent through the API.
Symptom
Parts of the attachment retain the foreign characters and others do not, namely the subject of the email retains the foreign characters alongside the body, content of attachment retains characters as well, however the filename field of the attachment does not. Should the customer need to use foreign, non-ASCII characters such as the umlaut (Ü), they will need to utilize ISO-8859 as detailed below. An example is if the following request is sent in UTF-8, the subject looks correct 'Beställningsbekräftelse',
but the filename field turns into "Beställningsbekräftelse" when the email is received.
Solution
Our system will automatically encode the body with whatever encoding is being passed to us. This means, if there are characters in the email that are Non-ASCII it will reflect properly. Essentially the body is going to be utilizing that encoding. The caveat is specifically the filename field requires only ASCII characters and will not pass Non-ASCII characters.
Going forward, one would conform to using ASCII characters for the filename field. Or put a procedure in place to decode them into UTF-8 when they are received. For more in depth help with code, I would suggest reaching out to one of the GitHub boards for the language being used. https://github.com/sendgrid/