cvs: php-news-web / article.php

From: Date: Tue, 10 Sep 2002 18:26:29 +0000
Subject: cvs: php-news-web / article.php
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-12403@lists.php.net to get a copy of this message
jimw Tue Sep 10 14:26:29 2002 EDT Modified files: /php-news-web article.php Log: handle encoding (patch from wez, with some tweaks) Index: php-news-web/article.php diff -u php-news-web/article.php:1.13 php-news-web/article.php:1.14 --- php-news-web/article.php:1.13 Tue Jul 2 20:00:55 2002 +++ php-news-web/article.php Tue Sep 10 14:26:29 2002 @@ -16,7 +16,7 @@ or die("failed to get article ".htmlspecialchars($article)); $inheaders = 1; $headers = array(); -$charset = ""; +$charset = $encoding = ""; $lk = ''; while (!feof($s)) { $line = fgets($s, 4096); @@ -29,6 +29,7 @@ && preg_match("/charset=(\"|'|)(.+)\\1/s", $headers['content-type'], $m)) { $charset = trim($m[2]); } + $encoding = strtolower(trim($headers['content-transfer-encoding'])); continue; } # fix lines that started with a period and got escaped @@ -44,6 +45,15 @@ } } else { + switch($encoding) { + case "quoted-printable": + $line = quoted_printable_decode($line); + break; + case "base64": + $line = base64_decode($line); + break; + } + # this is some amazingly simplistic code to color quotes/signatures # differently, and turn links into real links. it actually appears # to work fairly well, but could easily be made more sophistimicated.

« previous php.mirrors (#12403) next »