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("/", "\\", __DIR__ . "/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--CLEAN--
31<?php
32
33$fpath = str_replace("/", "\\", __DIR__ . "/bug66431.txt");
34
35if (file_exists($fpath)) {
36    unlink($fpath);
37}
38?>
39--EXPECT--
40bool(true)
41