Charset Property

Topic Last Modified: 2006-06-13

The character set for the body part.

Applies To

IBodyPart Interface

Type Library

Microsoft CDO for Exchange 2000 Library

DLL Implemented In

CDOEX.DLL

Syntax

Property Charset As String
HRESULT get_Charset(BSTR* pVal);HRESULT put_Charset(BSTR Val);

Parameters

  • pVal
    Returns the value of the Charset property as a reference to a BSTR.
  • Val
    Sets the value of the Charset property to the value of the BSTR.

Remarks

The Charset property corresponds to the "charset" attribute parameter of the Content-Type header field of RFC 2045. Charset does not include any types or subtypes. Only text body parts have an associated character set.

The default content type under RFC 822 is plain text US-ASCII (ANSI X3.4-1986). The currently permissible character set names include "us-ascii", "iso-8859-nnnnn", and "x-ttttt", where "nnnnn" is one to five decimal digits representing an Industry Standards Organization (ISO) code page and "ttttt" is an extension token. Character set "iso-8859-1" is the same as "us-ascii". However, certain message transfer agents and user agents might require one of these two strings and not accept the other.

Note

When working with body parts that contain mixed character sets, you can specify the character set used in the message's header fields by setting the Message object's IBodyPart.Charset property. There is no corresponding top-level charset parameter in the transmitted stream; this value is used to encode these headers when they are set using the IMessage interface properties, or through fields within the urn:schemas:httpmail: namespace using the mechanism defined in RFC 1522.

You can use any Charset value that is installed/supported on your system. The following table defines some of the module constants that are available through the type library and header files for use with the Charset property.

cdoCharset Module Constants

Constant Value

cdoBIG5

"big5"

cdoEUC_JP

"euc-jp"

cdoEUC_KR

"euc-kr"

cdoGB2312

"gb2312"

cdoISO_2022_JP

"iso-2022-jp"

cdoISO_2022_KR

"iso-2022-kr"

cdoISO_8859_1

"iso-8859-1"

cdoISO_8859_2

"iso-8859-2"

cdoISO_8859_3

"iso-8859-3"

cdoISO_8859_4

"iso-8859-4"

cdoISO_8859_5

"iso-8859-5"

cdoISO_8859_6

"iso-8859-6"

cdoISO_8859_7

"iso-8859-7"

cdoISO_8859_8

"iso-8859-8"

cdoISO_8859_9

"iso-8859-9"

cdoKOI8_R

"kio8-r"

cdoShift_JIS

"shift-jis"

cdoUS_ASCII

"us-ascii"

cdoUTF_7

"utf-7"

cdoUTF_8

"utf-8"

The contents of Charset are not case-sensitive. The default value is "us-ascii".