4

I'm writing a specification that essentially requires ASCII characters in an email message. I do recall that an email message can have a subject encoded in a foreign language, however I don't know what that encoding is called.

I don't think the encoding in the subject is as straightforward as saying UTF-8 or UTF-16, because other variations may exist.

What encodings can be used for an email subject line?

1 Answer 1

5

E-mail without MIME support (which is optional) is defined by RFC 5322, and only allows "printable" ASCII characters. MIME extends this standard and allows other encoding schemes for certain fields (subject included).

When encoding a header, you use the "Encoded-Word" method:

The form is: "=?charset?encoding?encoded text?=".

charset may be any character set registered with IANA. Typically it would be the same charset as the message body.
encoding can be either "Q" denoting Q-encoding that is similar to the quoted-printable encoding, or "B" denoting base64 encoding.
encoded text is the Q-encoded or base64-encoded text.
An encoded-word may not be more than 75 characters long, including charset, encoding, encoded text, and delimiters. If it is desirable to

encode more text than will fit in an encoded-word of 75 characters, multiple encoded-words (separated by CRLF SPACE) may be used.

1
  • This is what I was remembering, had totally forgotten the name. Thanks! Aug 16, 2013 at 19:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .