diff options
| author | wjames5 <will@tekimaki.com> | 2009-06-17 13:38:18 +0000 |
|---|---|---|
| committer | wjames5 <will@tekimaki.com> | 2009-06-17 13:38:18 +0000 |
| commit | 675fb0a2de27b597cf74cfad70e14ff1863500b4 (patch) | |
| tree | b7e3e8d57c207c2dfa79defdc3bed623d128b456 | |
| parent | 03567f95c736e6cb06b45dd6e0bf29b9c2affb0c (diff) | |
| download | boards-675fb0a2de27b597cf74cfad70e14ff1863500b4.tar.gz boards-675fb0a2de27b597cf74cfad70e14ff1863500b4.tar.bz2 boards-675fb0a2de27b597cf74cfad70e14ff1863500b4.zip | |
if email part header specifies a different charset then encode to utf-8
| -rw-r--r-- | admin/boardsync_inc.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/admin/boardsync_inc.php b/admin/boardsync_inc.php index 4ac2e71..8e8233a 100644 --- a/admin/boardsync_inc.php +++ b/admin/boardsync_inc.php @@ -82,6 +82,17 @@ function board_parse_msg_parts( &$pPartHash, $pMbox, $pMsgId, $pMsgPart, $pPartN } switch( $pMsgPart->type ) { case '0': + // make sure text is UTF-8 + if( $pMsgPart->ifparameters ){ + foreach( $pMsgPart->parameters as $params ){ + // we trust the email source to specify the correct charset + // Note: alternatively one might run a check to make sure the text is really utf-8, regardless of the header + if( $params->attribute == 'CHARSET' && $params->value != 'UTF-8' ){ + $part = @iconv($params->value, 'UTF-8', $part ); + } + } + } + // put msg in hash $pPartHash[$pPartNum][strtolower($pMsgPart->subtype)] = $part; break; default: |
