1--TEST--
2Bug #66431 Special Character via COM Interface (CP_UTF8), Scripting.FileSystemObject
3--SKIPIF--
4<?php
5if (!extension_loaded("com_dotnet")){ echo "skip COM/.Net support not present"; }
6?>
7--FILE--
8<?php
9
10$text= "Xin chào cộng đồng PHP";
11$fpath = str_replace("/", "\\", dirname(__FILE__) . "/bug66431.txt");
12
13$fso = new COM("Scripting.FileSystemObject");
14$fh = $fso->OpenTextFile($fpath, 2, true);
15$fh->Write($text);
16$fh->Close();
17
18$check_text = file_get_contents($fpath);
19
20$result = ($check_text == $text);
21
22var_dump($result);
23
24if (!$result) {
25	echo "Expected: '$check_text'\n";
26	echo "Have: '$text'\n";
27}
28
29?>
30===DONE===
31--CLEAN--
32<?php
33
34$fpath = str_replace("/", "\\", dirname(__FILE__) . "/bug66431.txt");
35
36if (file_exists($fpath)) {
37	unlink($fpath);
38}
39?>
40--EXPECT--
41bool(true)
42===DONE===
43