Browse Source

parser: force libxml error messages to valid utf8

Andrew Dolgov 2 months ago
parent
commit
9423d72f6c
2 changed files with 6 additions and 2 deletions
  1. 3 1
      classes/feedparser.php
  2. 3 1
      classes/rssutils.php

+ 3 - 1
classes/feedparser.php

@@ -183,10 +183,12 @@ class FeedParser {
 		}
 	}
 
+	// libxml may have invalid unicode data in error messages
 	function error() {
-		return $this->error;
+		return UConverter::transcode($this->error, 'UTF-8', 'UTF-8');
 	}
 
+	// WARNING: may return invalid unicode data
 	function errors() {
 		return $this->libxml_errors;
 	}

+ 3 - 1
classes/rssutils.php

@@ -1170,10 +1170,12 @@ class RSSUtils {
 			$sth->execute([$error_msg, $feed]);
 
 			unset($rss);
+
+			Debug::log("update failed.", Debug::$LOG_VERBOSE);
 			return false;
 		}
 
-		Debug::log("done", Debug::$LOG_VERBOSE);
+		Debug::log("update done.", Debug::$LOG_VERBOSE);
 
 		return true;
 	}