From a65b29015c5cb1ae175d7c57f683828ad4bfe3c5 Mon Sep 17 00:00:00 2001 From: savvasha Date: Thu, 21 Feb 2019 21:35:26 +0200 Subject: [PATCH] Convert &#[0-9]+ entities to UTF-8 --- feeds/ical.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/feeds/ical.php b/feeds/ical.php index bac542c9..5e12bfd3 100644 --- a/feeds/ical.php +++ b/feeds/ical.php @@ -134,11 +134,14 @@ foreach ( $events as $event): } else { $summary = $event->post_title; } - + + //Convert &#[0-9]+ entities to UTF-8 + $summary = preg_replace_callback("/(&#[0-9]+;)/", function($m) { return mb_convert_encoding($m[1], "UTF-8", "HTML-ENTITIES"); }, $summary); + // Append to output string $output .= "BEGIN:VEVENT\r\n" . - "SUMMARY:" . preg_replace('/([\,;])/','\\\$1', $summary) . "\r\n" . + "SUMMARY:" . preg_replace( '/([\,;])/','\\\$1', $summary ) . "\r\n" . "UID:$event->ID\r\n" . "STATUS:CONFIRMED\r\n" . "DTSTAMP:19700101T000000\r\n".