FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Bug Reports » maillists: "Subject" & headers handling
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
maillists: "Subject" & headers handling [message #19267] Mon, 05 July 2004 21:33 Go to next message
Klopp   Russian Federation
Messages: 1
Registered: July 2004
Karma: 0
Junior Member
Possible error while headers handling. Example, original "Subject" field is:

=?UTF-8?B?0J7RgtCy0LXRgg==?= Re: =?UTF-8?B?0JAg0YLQsNC6PyDQvtGC?=


After posting, topic view:

ответ Re: =?UTF-8?B?0JAg0YLQsNC6PyDQvtGC?=


P.S. Patch for valid body & headers encoding:

include/scripts_common.inc:

function decode_string($str, $encoding, $charset='')
{
    $s = '';
    switch ($encoding) 
    {
	case 'quoted-printable':
		// Remove soft line breaks & decode
	    $s = quoted_printable_decode( preg_replace("!=\r?\n!", '', $str) );
	    break;
	case 'base64':
	    $s = base64_decode( $str );
	    break;
	default:
	    $s = $str;
	    break;
    }
    if( $charset )
    {
	$s = recode( "$charset..$FORUM_CHARSET", $s );
    }
    return $s;    
}

function decode_header_value($val)
{
// ..skipped..
	    if ($ec_type == 'q') 
	    {
		$newval .= decode_string(str_replace('_', ' ', $m[5][$i]), 'quoted-printable', $m[3][$i]);
	    } 
	    else if ($ec_type == 'b') 
	    {
		$newval .= decode_string($m[5][$i], 'base64', $m[3][$i]);
	    }
// ..skipped..
}

scripts/maillist.php:

	function decode_message_body()
	{
	    $this -> body = decode_string( $this -> body, 
                            headers['content-transfer-encoding'], 
                               $this->headers['__other_hdr__']['content-type']['charset']);
	}
Re: maillists: "Subject" & headers handling [message #19268 is a reply to message #19267] Mon, 05 July 2004 22:25 Go to previous message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Fixed in CVS.

FUDforum Core Developer
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Problems with mailing lists (solved)
Next Topic: nntp and subject length
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 10 11:45:43 GMT 2024

Total time taken to generate the page: 0.02506 seconds