1--TEST--
2Dom\HTMLDocument GB18030 encoding test
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8$dom = Dom\HTMLDocument::createFromFile(__DIR__ . "/gb18030.html");
9var_dump($dom->charset);
10$dom->documentElement->firstChild->nextElementSibling->textContent = "é";
11$output = $dom->saveHtml();
12echo $output, "\n";
13$dom->saveHtmlFile(__DIR__ . "/gb18030_output.tmp");
14var_dump(file_get_contents(__DIR__ . "/gb18030_output.tmp") === $output);
15
16echo "--- After changing encoding to UTF-8 ---\n";
17$dom->charset = "UTF-8";
18echo $dom->saveHtml(), "\n";
19
20?>
21--CLEAN--
22<?php
23@unlink(__DIR__ . "/gb18030_output.tmp");
24?>
25--EXPECT--
26string(7) "gb18030"
27<!DOCTYPE html><html><head>
28<meta charset="gb18030">
29</head>
30<body>��</body></html>
31bool(true)
32--- After changing encoding to UTF-8 ---
33<!DOCTYPE html><html><head>
34<meta charset="gb18030">
35</head>
36<body>é</body></html>
37