1--TEST-- 2Dom\HTMLDocument: overrideEncoding with incompatible charset 3--EXTENSIONS-- 4iconv 5dom 6--FILE-- 7<?php 8$doc = Dom\HTMLDocument::createFromString( 9 iconv( 10 'ISO-8859-1', 11 'UTF-8', 12 <<<'DOC' 13 <!DOCTYPE html> 14 <html> 15 <head> 16 <meta charset="iso-8859-1"> 17 <title>���</title> 18 </head> 19 <body> 20 ��� 21 </body> 22 </html> 23 DOC, 24 ), 25 overrideEncoding: 'utf-8' 26); 27 28var_dump(iconv('UTF-8', 'ISO-8859-1', $doc->getElementsByTagName('title')->item(0)->textContent)); 29var_dump(iconv('UTF-8', 'ISO-8859-1', $doc->getElementsByTagName('body')->item(0)->textContent)); 30?> 31--EXPECT-- 32string(9) "���" 33string(15) " 34 ��� 35 36" 37