質問

I have some utf-8 html like this:

<a href="http://example.com">Today&nbsp;11:12&nbsp;AM</a>

And getElementsByTagName('a')->item(0)->nodeValue returns this:

Today 11:12 AM

I am not having any problems with other nodes in this html.

What am I doing wrong?

役に立ちましたか?

解決 2

Source documents are ASP and IIS.

I ended up using this for the offending characters:

str_replace( chr(), chr(), $html);

他のヒント

try to explicitly set the encoding for the DOMDocument Object:

$dom = new DOMDocument('1.0', 'UTF-8');
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top