From 4e13c01624b26312237e957ff777baef7d1eefb7 Mon Sep 17 00:00:00 2001 From: Jacek Kowalski <Jacek@jacekk.info> Date: Sun, 08 Jul 2012 21:49:19 +0000 Subject: [PATCH] Dalsze poprawki błędów związanych z kodowaniem znaków na stronach programu telewizyjnego WP.pl --- data/tv/pobierz.php | 7 +++++-- data/tv/wp_parse.php | 8 +++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/data/tv/pobierz.php b/data/tv/pobierz.php index 12fc829..e79af95 100644 --- a/data/tv/pobierz.php +++ b/data/tv/pobierz.php @@ -60,6 +60,8 @@ ); $NUMOF = count($stations); +ini_set('mbstring.substitute_character', 'none'); + $c = curl_init(); $out = fopen('./xmltv-pre.xml', 'w'); fwrite($out, '<?xml version="1.0" encoding="UTF-8" ?> @@ -85,11 +87,12 @@ return; } + $data = mb_convert_encoding($data, 'UTF-8', 'UTF-8'); file_put_contents('./cache/'.$num.'_'.$date, $data); unset($data); } - $doc = new DOMDocument; + $doc = new DOMDocument('1.0', 'utf-8'); @$doc->loadHTMLFile('./cache/'.$num.'_'.$date); $wp = new wp_parse($doc); @@ -114,4 +117,4 @@ } } echo OK; -?> \ No newline at end of file +?> diff --git a/data/tv/wp_parse.php b/data/tv/wp_parse.php index 983e4cc..a1a3ecb 100644 --- a/data/tv/wp_parse.php +++ b/data/tv/wp_parse.php @@ -74,8 +74,6 @@ 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) { @@ -99,8 +97,8 @@ $program[$num][] = array( $godzina, - mb_convert_encoding($nazwa, 'UTF-8', 'UTF-8'), - mb_convert_encoding($opis, 'UTF-8', 'UTF-8') + $nazwa, + $opis ); } unset($programs_dom, $programs); @@ -138,4 +136,4 @@ } } } -?> +?> \ No newline at end of file -- Gitblit v1.9.1