summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-03-23 09:53:08 +0000
committeralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-03-23 09:53:08 +0000
commit96b94c9735ff17eb9378029a5606807652185794 (patch)
tree51d607e6c245275d36345dfc5aeba412b6bd2e99
parent9640dcc0b1416dbf3f5228bced54b07d821e9fc1 (diff)
- Mail_Mime-1.6.2
git-svn-id: https://svn.roundcube.net/trunk@3402 208e9e7b-5314-0410-a742-e7e81cd9613c
-rw-r--r--roundcubemail/program/lib/Mail/mimePart.php17
1 files changed, 9 insertions, 8 deletions
diff --git a/roundcubemail/program/lib/Mail/mimePart.php b/roundcubemail/program/lib/Mail/mimePart.php
index 21811703d..8d6d2577e 100644
--- a/roundcubemail/program/lib/Mail/mimePart.php
+++ b/roundcubemail/program/lib/Mail/mimePart.php
@@ -1066,16 +1066,17 @@ class Mail_mimePart
*/
function encodeQP($str)
{
- // Replace all special characters used by the encoder
- $search = array('=', '_', '?', ' ');
- $replace = array('=3D', '=5F', '=3F', '_');
- $str = str_replace($search, $replace, $str);
+ // Bug #17226 RFC 2047 restricts some characters
+ // if the word is inside a phrase, permit chars are only:
+ // ASCII letters, decimal digits, "!", "*", "+", "-", "/", "=", and "_"
- // Replace all extended characters (\x80-xFF) with their
- // ASCII values.
- return preg_replace_callback(
- '/([\x80-\xFF])/', array('Mail_mimePart', '_qpReplaceCallback'), $str
+ // "=", "_", "?" must be encoded
+ $regexp = '/([\x22-\x29\x2C\x2E\x3A-\x40\x5B-\x60\x7B-\x7E\x80-\xFF])/';
+ $str = preg_replace_callback(
+ $regexp, array('Mail_mimePart', '_qpReplaceCallback'), $str
);
+
+ return str_replace(' ', '_', $str);
}
/**