From 0f43672af99cea2f864ed00f402a446c23320c2a Mon Sep 17 00:00:00 2001 From: Eric Heikes Date: Sun, 13 Aug 2017 21:03:37 -0500 Subject: [PATCH] Decode numeric HTML entities in titles. --- toreadapi.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/toreadapi.php b/toreadapi.php index 61172c8..8532336 100644 --- a/toreadapi.php +++ b/toreadapi.php @@ -187,10 +187,15 @@ function getEntry() { $tags[] = $tagInfo['name']; } + $decodedTitle = html_entity_decode($item['title']); + $decodedTitle = preg_replace_callback("/&#[0-9]+;/", function($m) { + return mb_convert_encoding($m[0], 'UTF-8', 'HTML-ENTITIES'); + }, $decodedTitle); + // Add the link info to the array. $links[] = array( 'id' => intval($item['id']), - 'title' => html_entity_decode($item['title']), + 'title' => $decodedTitle, 'link' => $item['link'], 'description' => $item['keywords'], 'hasSnapshot' => !is_null($item['snapshot']),