From 9e8a1756b7032fba21fec82efda57cf896a2735a Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Mon, 08 Dec 2008 14:42:31 -0500
Subject: [PATCH] #1485616: read content-id/content-location only for multipart/related type

---
 program/lib/html2text.php |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/program/lib/html2text.php b/program/lib/html2text.php
index efc38a6..938dfec 100644
--- a/program/lib/html2text.php
+++ b/program/lib/html2text.php
@@ -232,7 +232,7 @@
         '--',
         '-',
         '*',
-        '�',
+        '£',
         'EUR',                                  // Euro sign. � ?
         '',                                     // Unknown/unhandled entities
         ' '                                     // Runs of spaces, post-handling
@@ -465,7 +465,10 @@
 
 	// Convert <PRE>
         $this->_convert_pre($text);
-	
+
+	// Replace known html entities
+	$text = html_entity_decode($text, ENT_COMPAT, 'UTF-8');
+
         // Run our defined search-and-replace
         $text = preg_replace($this->search, $this->replace, $text);
 
@@ -543,7 +546,7 @@
 	while(preg_match('/<pre[^>]*>(.*)<\/pre>/ismU', $text, $matches))
 	{
 	    $result = preg_replace($this->pre_search, $this->pre_replace, $matches[1]);
-	    $text = preg_replace('/<pre[^>]*>.*<\/pre>/ismU', '<div><br>' . $result . '<br></div>', $text);
+	    $text = preg_replace('/<pre[^>]*>.*<\/pre>/ismU', '<div><br>' . $result . '<br></div>', $text, 1);
 	}
     }
 }

--
Gitblit v1.9.1