Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

When you use Outlook to send an HTML e-mail message to an Exchange Server 2007 user, the e-mail message appears garbled, or it contains Asian characters


View products that this article applies to.

Symptoms

When you use Microsoft Office Outlook to send an HTML e-mail message to a Microsoft Exchange Server 2007 user, the e-mail message appears garbled, or it contains Asian characters.

This problem occurs when the following conditions are true:
  • The charset property that is in the HTML META tag is defined as "charset=UTF-16" or "charset=Unicode."
  • The charset property is not specified in the MIME part of the e-mail message, and the e-mail message body is not multibyte.
The following is an example of an HTML META tag.
------=_NextPart_000_0001_01C889B5.74713040
Content-Type: text/html
Content-Transfer-Encoding: 7bit

<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-16"> 
Note This problem occurs in Exchange 2007 Update Rollup 6 and in Update Rollup 1 for Exchange Server 2007 Service Pack 1.

↑ Back to the top


Cause

This problem may occur if one of the following conditions is true:
  • The code of the e-mail system that sent the e-mail message incorrectly described the HTML part of the message. The code and the byte stream used different values for the charset property. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
    941851 An HTML e-mail message appears garbled in Outlook when you send the message to an Exchange Server 2007 user
  • You applied an XSLT style sheet to an HTML document. The resulting XML document may be mismatched on several levels. This mismatch may occur because a tool used the original encoding type to save the XML document. The tool may be the method that transformed the data, an API, or another tool.

↑ Back to the top


Resolution

To resolve this problem, ask the sender of the original e-mail message to change the code that generates the XML or to specify the desired encoding. To use UTF-8 or another character set to correctly define the HTML e-mail message, use one of the following methods:
  • Add an <xsl:element> element to the style sheet to create a top-level element for the output.
  • Add an <xsl:output> element to the style sheet to specify the encoding. For example, use the following element.
    <xsl:output method="XML" encoding="UTF-8" />

↑ Back to the top


Workaround

To work around this problem, follow these steps:
  1. Create a new remote domain. You can do this in the Exchange Management Console or in the Exchange Management Shell for the sending domain.
  2. Right-click the new remote domain, and then click Properties.
  3. Click Format of original message sent as attachment to journal report, and then change the Character Sets for non-MIME character set setting to UTF-8.
Note This workaround alters the non-MIME character set encoding for all e-mail messages that are sent to the remote domain and that are received from the remote domain. The encoding is set to UTF-8 for all e-mail messages. Therefore, this workaround may not be appropriate for all situations. Use this workaround if it is appropriate for your environment.

↑ Back to the top


Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

↑ Back to the top


More information

There are two methods for producing XML documents by using XSL transformation from MSXML. You can call the transformNode method of the Document Object Model (DOM) document, or you can call the transformNodeToObject method.

Method 1: Use the transformNode method

The transformNode method always returns a Unicode string (UTF-16). For the English language, the second byte is 0x00.

If you set the encoding attribute in the <xsl:output> element to UTF-8, the data is not converted correctly. If no output method is specified, the default format depends on the kind of output (XML or HTML). If the output is HTML, a META tag that uses "charset=UTF-16" to set the output encoding is inserted into the HTML. For example, the following META tag may be used.
<META http-equiv="Content-Type" content="text/html; charset=UTF-16">
If the response.write function is used in a classic ASP page to write the stream data back to the browser, the UTF-16-based string that is returned from the transformNode method is converted to ISO-8859-1 characters. This behavior also occurs if the Scripting.FileSystemObject method is used to save the output to a file. ISO-8859-1characters are not two bytes long. Therefore, a mismatch between the specified encoding and the actual encoding of data can occur, even if you specified UTF-16 or Unicode encoding. However, if you saved the message to a file that uses a suitable byte order, the file will use Unicode encoding.

Method 2: Use the transformNodeToObject method

The transformNodeToObject method preserves the requested encoding. However, if you specify UTF-16 encoding, and then you save the document to a file by using a method that uses UTF-8 or ASNI encoding, a mismatch occurs. To preserve the encoding that is specified in the style sheet, you can use the .Save method for the generated MSXML DOMDocument object.

Best practice

We recommend that you make sure that the specified encoding matches the actual encoding at every level in a document. The following example creates an HTML document that has "charset=UTF-16" defined in the HTML META tag.
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method=�html� encoding=�UTF-16� />
  <xsl:template match="/hello-world">
    <HTML>
      <HEAD>
        <TITLE></TITLE>
      </HEAD>
      <BODY>
        <H1>
          <xsl:value-of select="greeting"/>
        </H1>
        <xsl:apply-templates select="greeter"/>
      </BODY>
    </HTML>
  </xsl:template>
  <xsl:template match="greeter">
    <DIV>from <I><xsl:value-of select="."/></I></DIV>
  </xsl:template>
</xsl:stylesheet>
To correctly define the HTML document as an UTF-8 encoded document, add an <xsl:output> element to the style sheet, and then use an XML API that preserves the encoding.
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="xml" encoding="UTF-8"/>
  <xsl:template match="/hello-world">
    <HTML>
      <HEAD>
        <TITLE></TITLE>
      </HEAD>
      <BODY>
        <H1>
          <xsl:value-of select="greeting"/>
        </H1>
        <xsl:apply-templates select="greeter"/>
      </BODY>
    </HTML>
  </xsl:template>
  <xsl:template match="greeter">
    <DIV>from <I><xsl:value-of select="."/></I></DIV> 
  </xsl:template>
</xsl:stylesheet>

↑ Back to the top


Keywords: KB952771, kbprb, kbexpertiseinter, kbtshoot

↑ Back to the top

Article Info
Article ID : 952771
Revision : 1
Created on : 6/19/2008
Published on : 6/19/2008
Exists online : False
Views : 371