I am working on a project where I need to send requests over email instead of http,
to prevent email servers or clients from messing with the body (especially urls) I have set the Content-Type
header in my SMTP request to application/octet-stream
instead of text/plain
.
The content however is actually plain text so I also specified ;charset=UTF-8
.
Looking at RFC it seems that the charset
parameter is only allowed for text/*
types, however I also found many examples where charset
was used with application/*
types.
Now I wonder, is application/octet-stream; charset=UTF-8
a valid MIME type?
As the application/octet-stream
definition (IANA-RFC) doesn't define a charset for this applicationtype and the definition for application/json
(IANA-RFC) a mimetype thats used more often includes a note:
No "charset" parameter is defined for this registration.
Adding one really has no effect on compliant recipients.
I would strongly recommend to assume that the statement not only applies in this special case, but also in other application/*
which have no charset
defined.
So I can't say if it is valid to pass parameters that aren't defined, but the RFC clearly implies that the charset
parameter for application/octet-stream
(and other application/*
that do not define charset
) has no effect.