Convert &#[0-9]+ entities to UTF-8

This commit is contained in:
savvasha
2019-02-21 21:35:26 +02:00
parent 5020512242
commit a65b29015c

View File

@@ -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".