Command MSG_Charset

4D Internet Commands

MSG_Charset

version 6.8.1


MSG_Charset (decodeHeaders; bodyCharset) Integer

ParameterTypeDescription
decodeHeadersInteger-1 = Use current settings, 0 = Do not manage,
1 = Convert using the Mac OS char set
if ISO-8859-1 or ISO-2022-JP, decode
extended characters
bodyCharsetInteger-1 = Use current settings, 0 = Do not manage,
1 = Convert using the Mac OS char set
if ISO-8859-1 or ISO-2022-JP

Function result Integer Error code

Description

The MSG_Charset command allows automatic support of messages containing extended characters during processing with the MSG commands. If this command is not called or has parameters set to 0, 4D Internet Commands version 6.8.1 or higher will work the same way as version 6.5.x.

MSG_Charset allows, first of all, the setting of whether the extended characters header decoding must be managed and, second, the determining of whether the message body and header character set conversion must be managed.

This command is particularly useful for supporting extended characters included in message headers such as the "Subject" or electronic mail addresses (for instance, to decode an address such as "=?ISO-8859-1?Q?Test=E9?= <[email protected] >").

The decodeHeaders parameter specifies how to manage header decoding and conversion while executing MSG_FindHeader. Default value is set to 0.

• -1: Use current settings;

• 0: Do not manage;

• 1: Headers are decoded if necessary. If decoded, and if the specified character set is ISO-8859-1 or ISO-2022-JP, headers are converted using Mac OS ASCII code or Shift-JIS respectively.

The bodyCharset parameter specifies how to manage message body character set conversion while executing the MSG_GetBody command. Default value is set to 0.

• -1: Use current settings;

• 0: Do not manage;

• 1: If the "Body-Content-Type" character set is set to ISO-8859-1 or ISO-2022-JP, the message body is converted using Mac OS ASCII code or Shift-JIS respectively.

Compatibility note (version 6.8.1): If the MSG_Charset command is not used and the POP3_Charset command has been used, the MSG_FindHeader and MSG_GetBody commands will take the POP3_Charset parameters into account. If MSG_Charset is used, the POP3_Charset parameters are ignored.

Examples

1. Using version 6.5.x of 4D Internet Commands:

   $Err:=MSG_FindHeader($msgfile;"From";$from)
   $from:=ISO to Mac($from)
   $Err:=MSG_FindHeader($msgfile;"To";$to)
   $to:=ISO to Mac($to)
   $Err:=MSG_FindHeader($msgfile;"Cc";$cc)
   $cc:=ISO to Mac($cc)
   $Err:=MSG_FindHeader($msgfile;"Subject";$subject)
   $subject:=ISO to Mac($subject)
   $Err:=MSG_MessageSize($msgfile;$HdrSize;$BdySize;$msgSize)
   $Err:=MSG_GetBody($msgfile;0;$BdySize;$BodyContent)
   $BodyContent:=ISO to Mac($BodyContent)

2. Using version 6.8.1 or higher of 4D Internet Commands:

   $Err:=MSG_Charset(1;1)
   $Err:=MSG_FindHeader($msgfile;"From";$from)
   $Err:=MSG_FindHeader($msgfile;"To";$to)
   $Err:=MSG_FindHeader($msgfile;"Cc";$cc)
   $Err:=MSG_FindHeader($msgfile;"Subject";$subject)
   $Err:=MSG_MessageSize($msgfile;$HdrSize;$BdySize;$msgSize)
   $Err:=MSG_GetBody($msgfile;0;$BdySize;$BodyContent).

See Also

POP3_Charset, SMTP_Charset.