summaryrefslogtreecommitdiff
path: root/roundcubemail/program/lib
diff options
context:
space:
mode:
authorroundcube <roundcube@208e9e7b-5314-0410-a742-e7e81cd9613c>2005-10-21 12:12:23 +0000
committerroundcube <roundcube@208e9e7b-5314-0410-a742-e7e81cd9613c>2005-10-21 12:12:23 +0000
commita859a759e8ca812a55ac36aba2e36446c17574e0 (patch)
tree4b91e5aa1cd01d69facdc1194137ac46666c3d0a /roundcubemail/program/lib
parente8ee29555cd7845b3fbfcaab6f012608f80ad442 (diff)
Improved support for UTF-8 and other charsets
git-svn-id: https://svn.roundcube.net/trunk@50 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/lib')
-rw-r--r--roundcubemail/program/lib/Mail/mimeDecode.php2
-rw-r--r--roundcubemail/program/lib/imap.inc9
-rw-r--r--roundcubemail/program/lib/utf8.inc4
3 files changed, 11 insertions, 4 deletions
diff --git a/roundcubemail/program/lib/Mail/mimeDecode.php b/roundcubemail/program/lib/Mail/mimeDecode.php
index 07fe88f6e..851481434 100644
--- a/roundcubemail/program/lib/Mail/mimeDecode.php
+++ b/roundcubemail/program/lib/Mail/mimeDecode.php
@@ -247,7 +247,7 @@ class Mail_mimeDecode extends PEAR
$return->ctype_primary = $regs[1];
$return->ctype_secondary = $regs[2];
}
-
+
if (isset($content_type['other'])) {
while (list($p_name, $p_value) = each($content_type['other'])) {
$return->ctype_parameters[$p_name] = $p_value;
diff --git a/roundcubemail/program/lib/imap.inc b/roundcubemail/program/lib/imap.inc
index 22757ba82..3d37bed17 100644
--- a/roundcubemail/program/lib/imap.inc
+++ b/roundcubemail/program/lib/imap.inc
@@ -1239,8 +1239,13 @@ function iil_C_FetchHeaders(&$conn, $mailbox, $message_set){
$result[$id]->cc = str_replace("\n", " ", $headers["cc"]);
$result[$id]->encoding = str_replace("\n", " ", $headers["content-transfer-encoding"]);
$result[$id]->ctype = str_replace("\n", " ", $headers["content-type"]);
- //$result[$id]->in_reply_to = ereg_replace("[\n<>]",'', $headers['in-reply-to']);
- list($result[$id]->ctype,$foo) = explode(";", $headers["content-type"]);
+ $result[$id]->in_reply_to = ereg_replace("[\n<>]",'', $headers['in-reply-to']);
+
+ list($result[$id]->ctype, $ctype_add) = explode(";", $headers["content-type"]);
+
+ if (preg_match('/charset="?([a-z0-9\-]+)"?/i', $ctype_add, $regs))
+ $result[$id]->charset = $regs[1];
+
$messageID = $headers["message-id"];
if ($messageID) $messageID = substr(substr($messageID, 1), 0, strlen($messageID)-2);
else $messageID = "mid:".$id;
diff --git a/roundcubemail/program/lib/utf8.inc b/roundcubemail/program/lib/utf8.inc
index 72a96b4e9..43ecb328b 100644
--- a/roundcubemail/program/lib/utf8.inc
+++ b/roundcubemail/program/lib/utf8.inc
@@ -88,7 +88,9 @@ function utf8ToUnicodeEntities ($source) {
$thisPos++;
}
- if ($thisLen == 1)
+ if ($decimalCode<128)
+ $encodedLetter = chr($decimalCode);
+ else if ($thisLen == 1)
$encodedLetter = "&#". str_pad($decimalCode, 3, "0", STR_PAD_LEFT) . ';';
else
$encodedLetter = "&#". str_pad($decimalCode, 5, "0", STR_PAD_LEFT) . ';';