Skip to content
Snippets Groups Projects
Commit 29f3a5fa authored by Andreas Gohr's avatar Andreas Gohr
Browse files

user the MAILHEADER_EOL in quoted printable encoding

darcs-hash:20060606191953-7ad00-0e8098d5d8f4cf5379f3cce0e6899ac11c20a321.gz
parent 5f312bac
No related branches found
No related tags found
No related merge requests found
......@@ -12,7 +12,7 @@ class mail_quotedprintable_encode extends UnitTestCase {
function test_spaceend(){
$in = "hello \nhello";
$out = "hello=20\r\nhello";
$out = "hello=20\nhello";
$this->assertEqual(mail_quotedprintable_encode($in),$out);
}
......@@ -24,7 +24,7 @@ class mail_quotedprintable_encode extends UnitTestCase {
function test_wrap(){
$in = '123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789';
$out = "123456789 123456789 123456789 123456789 123456789 123456789 123456789 1234=\r\n56789 123456789";
$out = "123456789 123456789 123456789 123456789 123456789 123456789 123456789 1234=\n56789 123456789";
$this->assertEqual(mail_quotedprintable_encode($in,74),$out);
}
......
......@@ -9,7 +9,9 @@
if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
require_once(DOKU_INC.'inc/utf8.php');
define('MAILHEADER_EOL',"\n"); //end of line for mail headers
// end of line for mail lines - RFC822 says CRLF but postfix (and other MTAs?)
// think different
if(!defined('MAILHEADER_EOL')) define('MAILHEADER_EOL',"\n");
#define('MAILHEADER_ASCIIONLY',1);
/**
......@@ -210,12 +212,12 @@ function mail_quotedprintable_encode($sText,$maxlen=74,$bEmulate_imap_8bit=true)
// but this wouldn't be caught by such an easy RegExp
if($maxlen){
preg_match_all( '/.{1,'.($maxlen - 2).'}([^=]{0,2})?/', $sLine, $aMatch );
$sLine = implode( '=' . chr(13).chr(10), $aMatch[0] ); // add soft crlf's
$sLine = implode( '=' . MAILHEADER_EOL, $aMatch[0] ); // add soft crlf's
}
}
// join lines into text
return implode(chr(13).chr(10),$aLines);
return implode(MAILHEADER_EOL,$aLines);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment