1--TEST-- 2Dom\HTMLDocument UTF-16LE BOM encoding test 3--EXTENSIONS-- 4dom 5--FILE-- 6<?php 7 8$dom = Dom\HTMLDocument::createFromFile(__DIR__ . "/utf16le_bom.html"); 9var_dump($dom->inputEncoding); 10$dom->documentElement->firstChild->nextElementSibling->textContent = "é"; 11$output = $dom->saveHtml(); 12echo $output, "\n"; 13$dom->saveHtmlFile(__DIR__ . "/utf16le_bom_output.tmp"); 14var_dump(file_get_contents(__DIR__ . "/utf16le_bom_output.tmp") === $output); 15 16echo "--- After changing encoding to UTF-8 ---\n"; 17$dom->inputEncoding = "UTF-8"; 18echo $dom->saveHtml(), "\n"; 19 20?> 21--CLEAN-- 22<?php 23@unlink(__DIR__ . "/utf16le_bom_output.tmp"); 24?> 25--EXPECTF-- 26string(8) "UTF-16LE" 27<%0!%0D%0O%0C%0T%0Y%0P%0E%0 %0h%0t%0m%0l%0>%0<%0h%0t%0m%0l%0>%0<%0h%0e%0a%0d%0>%0 28%0<%0!%0-%0-%0 %0i%0n%0t%0e%0n%0t%0i%0o%0n%0a%0l%0 %0l%0i%0e%0s%0 %0a%0n%0d%0 %0d%0e%0c%0e%0i%0t%0 %0-%0-%0>%0 29%0<%0m%0e%0t%0a%0 %0c%0h%0a%0r%0s%0e%0t%0=%0"%0u%0t%0f%0-%08%0"%0>%0 30%0<%0/%0h%0e%0a%0d%0>%0 31%0<%0b%0o%0d%0y%0>%0�%0<%0/%0b%0o%0d%0y%0>%0<%0/%0h%0t%0m%0l%0>%0 32bool(true) 33--- After changing encoding to UTF-8 --- 34<!DOCTYPE html><html><head> 35<!-- intentional lies and deceit --> 36<meta charset="utf-8"> 37</head> 38<body>é</body></html> 39