No need to encode HTML objects in the subject line. The reason for encoding in the body of HTML is because you use XHTML, which, since it comes from XML, treats &
as a reserved character.
However, the subject line of the message is not in HTML, XML or XHTML. It is just plain text. Because of this, you do not need to encode the ampersand as &
. If you encode it because it is not parsed as HTML, it will be displayed as encoded.
If you want to include non-ASCII characters (like £
), you need to encode the entire "envelope" (including the body of the email) as UTF-8.
Thus, the code will show the following:
| Subject Line | Body ==================================== & | & | & & | & | & UTF-8 £ | £ | £ ASCII £ | n/a | n/a £ | £ | £
NB: Microsoft Office has a strange implementation of UTF-8, so not all UTF-8 characters will work.
source share