不能在标题解码HTML实体
问题描述:
我无法从这个YouTube视频解码标题实体
http://www.youtube.com/watch?v=p7NMsywVQhY
这里是我的代码:
$url = 'http://www.youtube.com/watch?v=p7NMsywVQhY';
$html = @file_get_contents($url);
$doc = new DOMDocument();
@$doc->loadHTML($html);
$nodes = $doc->getElementsByTagName('title');
$title = $nodes->item(0)->nodeValue;
//decode the '‪' in the title
$title = html_entity_decode($title,ENT_QUOTES,'UTF-8'); //does not seem to have any effect
//decode the utf data
$title = utf8_decode($title);
$标题返回一切很好,除了返回问号‪
最初是在标题中。
谢谢。
Êa;是unicode中的“从左到右嵌入”,它不应该是可打印的字符。 – 2011-05-26 21:56:40
好的,那么我怎样才能从字符串中删除这些类型的代码? – Alex 2011-05-26 22:06:10
搜索和替换可能是最好的选择。 – 2011-05-26 22:06:38