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