diff --git a/epg2xml-web.php b/epg2xml-web.php
index 5715447..661faa0 100644
--- a/epg2xml-web.php
+++ b/epg2xml-web.php
@@ -932,9 +932,9 @@ function GetEPGFromIscs($ChannelInfo) {
endif;
else :
$response = $data['html'];
- $response = mb_convert_encoding($response, "HTML-ENTITIES", "UTF-8");
$pattern = '/
(.*)<\/td>/';
$response = preg_replace_callback($pattern, function($matches) { return ' | '.htmlspecialchars($matches[1]).' | ';}, $response);
+ $response = mb_convert_encoding($response, "HTML-ENTITIES", "UTF-8");
$dom = new DomDocument;
libxml_use_internal_errors(True);
if($dom->loadHTML($response)):
diff --git a/epg2xml.php b/epg2xml.php
index 7a4a689..0e37cab 100644
--- a/epg2xml.php
+++ b/epg2xml.php
@@ -951,9 +951,9 @@ function GetEPGFromIscs($ChannelInfo) {
endif;
else :
$response = $data['html'];
- $response = mb_convert_encoding($response, "HTML-ENTITIES", "UTF-8");
$pattern = '/(.*)<\/td>/';
$response = preg_replace_callback($pattern, function($matches) { return ' | '.htmlspecialchars($matches[1]).' | ';}, $response);
+ $response = mb_convert_encoding($response, "HTML-ENTITIES", "UTF-8");
$dom = new DomDocument;
libxml_use_internal_errors(True);
if($dom->loadHTML($response)):