Encoding Accented Characters in E-mail Subjects

To send an e-mail where the subject contains accented characters, encode the string like so:

Bonne id?e

...becomes...

=?iso-8859-1?q?Bonne id=E9e?=

The string starts with =?iso-8859-1?q? and ends with ?=. Then every character to be encoded starts with the = and the hex value for that character.

I don't recall ever having run into this problem before but this solution works. If you know of another way to send accented characters in a subject line, let me know.

Published March 30, 2005 · Updated September 17, 2005
Categorized as Servers
Short URL: https://snook.ca/s/351

Conversation

1 Comment · RSS feed
Ben Kennedy said on March 31, 2005

This technique works for other headers too (e.g. From) and is not limited to any particular character set. For example, try this:

m=?UTF-8?B?w6ljaGFudCDimaUgY8WTdXI=?=

which should render as:

méchant ♥ cœur

Check out RFCs 1342 and 2047.

Sorry, comments are closed for this post. If you have any further questions or comments, feel free to send them to me directly.