Correction: Adding "charset" - patch for php_imap.c
| From: | Johan Ekenberg | Date: | Wed, 16 May 2001 21:39:03 +0000 |
| Subject: | Correction: Adding "charset" - patch for php_imap.c | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-55542@lists.php.net to get a copy of this message | ||
This time the patch is actually attached...
Attached is a suggested patch to make it possible to set the CHARSET parameter with
imap_mail_compose(). Currently, all body parts with Content-Type = TYPETEXT get CHARSET=US-ASCII.
Usage:
$body[1][type] = TYPETEXT;
$body[1][charset] = "iso-8859-1";
Chuck, if there are no objections to the patch, can you commit it?
Best regards,
/Johan Ekenberg
--- php_imap.c.bak Fri May 4 19:47:01 2001 +++ php_imap.c Wed May 16 23:18:56 2001 @@ -3255,6 +3255,14 @@ convert_to_long_ex(pvalue); bod->encoding = (short) Z_LVAL_PP(pvalue); } + if (zend_hash_find(Z_ARRVAL_PP(data), "charset", sizeof("charset"), (void **) &pvalue)== SUCCESS) { + convert_to_string_ex(pvalue); + tmp_param = mail_newbody_parameter(); + tmp_param->value = cpystr(Z_STRVAL_PP(pvalue)); + tmp_param->attribute = "CHARSET"; + tmp_param->next = bod->parameter; + bod->parameter = tmp_param; + } if (zend_hash_find(Z_ARRVAL_PP(data), "subtype", sizeof("subtype"), (void **) &pvalue)== SUCCESS) { convert_to_string_ex(pvalue); bod->subtype = cpystr(Z_STRVAL_PP(pvalue)); @@ -3332,6 +3340,14 @@ if (zend_hash_find(Z_ARRVAL_PP(data), "encoding", sizeof("encoding"), (void **) &pvalue)== SUCCESS) { convert_to_long_ex(pvalue); bod->encoding = (short) Z_LVAL_PP(pvalue); + } + if (zend_hash_find(Z_ARRVAL_PP(data), "charset", sizeof("charset"), (void **) &pvalue)== SUCCESS) { + convert_to_string_ex(pvalue); + tmp_param = mail_newbody_parameter(); + tmp_param->value = cpystr(Z_STRVAL_PP(pvalue)); + tmp_param->attribute = "CHARSET"; + tmp_param->next = bod->parameter; + bod->parameter = tmp_param; } if (zend_hash_find(Z_ARRVAL_PP(data), "subtype", sizeof("subtype"), (void **) &pvalue)== SUCCESS) { convert_to_string_ex(pvalue);
--- php_imap.c.bak Fri May 4 19:47:01 2001 +++ php_imap.c Wed May 16 23:18:56 2001 @@ -3255,6 +3255,14 @@ convert_to_long_ex(pvalue); bod->encoding = (short) Z_LVAL_PP(pvalue); } + if (zend_hash_find(Z_ARRVAL_PP(data), "charset", sizeof("charset"), (void **) &pvalue)== SUCCESS) { + convert_to_string_ex(pvalue); + tmp_param = mail_newbody_parameter(); + tmp_param->value = cpystr(Z_STRVAL_PP(pvalue)); + tmp_param->attribute = "CHARSET"; + tmp_param->next = bod->parameter; + bod->parameter = tmp_param; + } if (zend_hash_find(Z_ARRVAL_PP(data), "subtype", sizeof("subtype"), (void **) &pvalue)== SUCCESS) { convert_to_string_ex(pvalue); bod->subtype = cpystr(Z_STRVAL_PP(pvalue)); @@ -3332,6 +3340,14 @@ if (zend_hash_find(Z_ARRVAL_PP(data), "encoding", sizeof("encoding"), (void **) &pvalue)== SUCCESS) { convert_to_long_ex(pvalue); bod->encoding = (short) Z_LVAL_PP(pvalue); + } + if (zend_hash_find(Z_ARRVAL_PP(data), "charset", sizeof("charset"), (void **) &pvalue)== SUCCESS) { + convert_to_string_ex(pvalue); + tmp_param = mail_newbody_parameter(); + tmp_param->value = cpystr(Z_STRVAL_PP(pvalue)); + tmp_param->attribute = "CHARSET"; + tmp_param->next = bod->parameter; + bod->parameter = tmp_param; } if (zend_hash_find(Z_ARRVAL_PP(data), "subtype", sizeof("subtype"), (void **) &pvalue)== SUCCESS) { convert_to_string_ex(pvalue);