From 0078935fc140f0124af4ae5104cdd4f1613dc521 Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Sun, 08 Jul 2012 19:01:42 +0000
Subject: [PATCH] Poprawka parsowania programu telewizyjnego - filtrowanie znaków UTF-8 ze względu na problemy z kodowaniem na stronach WP

---
 data/tv/wp_parse.php |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/data/tv/wp_parse.php b/data/tv/wp_parse.php
index f3cb7c7..983e4cc 100644
--- a/data/tv/wp_parse.php
+++ b/data/tv/wp_parse.php
@@ -74,6 +74,8 @@
 	function xmltv($id, $fp) {
 		$program = array();
 		
+		ini_set('mbstring.substitute_character', 'none');
+		
 		$days_dom = $this->xpath->query('.//ul[@class="lsDay"]//li', $this->context);
 		$days = array();
 		foreach($days_dom as $day) {
@@ -95,7 +97,11 @@
 					$nazwa = $this->xpath->query('.//h3', $programs)->item(0)->textContent;
 					$opis = $this->xpath->query('.//p', $programs)->item(0)->textContent;
 					
-					$program[$num][] = array($godzina, $nazwa, $opis);
+					$program[$num][] = array(
+						$godzina,
+						mb_convert_encoding($nazwa, 'UTF-8', 'UTF-8'),
+						mb_convert_encoding($opis, 'UTF-8', 'UTF-8')
+					);
 				}
 				unset($programs_dom, $programs);
 			}

--
Gitblit v1.9.1