Jump to content

Stripping Special Char?


Arty Ziff

Recommended Posts

When I use DOM to extract content from HTML text files, I get "funny characters"

âsomethingââsomethingââ

When I look at the source, there is just white space.
$dom = new DOMDocument();
$dom->preserveWhiteSpace = false;
$dom->loadHTML($tblock[$i]);
$xpath = new DOMXPath($dom);

$tags = $xpath->query('//div[@class="desc"]/h2[@class="name"]');
foreach ($tags as $tag) {
	$tname[$i] = trim($tag->nodeValue);
	echo $tname[$i]."<br>";
}

How can I strip out those invisible special chars?

Link to comment
https://forums.phpfreaks.com/topic/232139-stripping-special-char/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.