Reputation: 161
I am sending an e-mail message containing HTML in the body. Below is a snippet of what is giving me grief.
EDIT: Here is more of the email, with sensitive information removed
MIME-Version: 1.0
From:
To:
Date:
Subject:
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width" />
<strong>€3,500</strong>
</body>
</html>
"€" is the UTF-8 encoding of the Euro symbol. So most email clients seem to render the Euro character just fine, EXCEPT in Microsoft Outlook 2007 (maybe later versions as well), where the Euro character is displayed as this "€".
Anybody know why this is happening?
Upvotes: 2
Views: 4544
Reputation: 189679
The message's MIME headers may or may not take precedence over the HTML meta tags in different clients. You'd better make sure they both agree.
:
--mimeboundary
Content-type: text/html; charset=utf-8
Content-transfer-encoding: 8bit
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
:
Upvotes: 3
Reputation: 66286
How are you setting the HTML? Are you setting the HTMLBody property? In that case the value must be UTF-16 since all strings in IDispatch-friendly COM are 2 byte UTF-16 strings.
It would be much better to property HTML-encode the special character rather than rely on the code page conversion.
Upvotes: 0