1<?php
2
3function create_data_from_utf8($id, $item = "", $cp = 65001)
4{
5	$prefix = dirname(__FILE__) . DIRECTORY_SEPARATOR . $id;
6
7	if (!is_dir($prefix)) {
8		mkdir($prefix);
9	}
10
11	/* Using a UTF-8 encoded filenames if !zend.multibyte, otherwise files in retrospective charset. */
12	switch ($id) {
13
14		case "file_mb3":
15			$content = "<?php
16
17echo \"hello there from the include\n\";";
18			create_verify_file($prefix, "českýtestování.inc", $content);
19			break;
20
21		case "bug71509":
22			$content = "that's my file with swedish filename
23";
24			create_verify_file($prefix, $item, $content);
25			break;
26
27		case "file_mb4":
28			create_verify_file($prefix, "š.txt", "");
29			break;
30
31		case "file_cp1252":
32			$content = "hallo
33";
34			create_verify_file($prefix, "tschüß", $content);
35			break;
36
37		case "file2_cp1252":
38			create_verify_file($prefix, $item, "hola");
39			break;
40
41		case "file2_mb":
42			create_verify_file($prefix, "Ελλάδα.txt", "");
43			break;
44
45		case "file_cp1251":
46			create_verify_file($prefix, $item, "opened an utf8 filename for reading", $cp);
47			break;
48
49		case "file_cp1255":
50		case "file_cp1254":
51		case "file_cp1253":
52		case "file_kartuli":
53		case "file_cp1250":
54		case "file_cp1256":
55		case "file_cp874":
56		case "file_big5":
57		case "file_cp936":
58		case "file_cp932":
59		case "file_eucjp":
60		case "file_mb":
61			$content = "reading file wihh multibyte filename
62";
63			create_verify_file($prefix, $item, $content, $cp);
64			break;
65
66		case "dir_mb":
67			create_verify_dir($prefix, "テストマルチバイト・パス42");
68			break;
69
70		case "dir_cp1255":
71		case "dir_cp1254":
72		case "dir_cp1253":
73		case "dir_kartuli":
74		case "dir_cp1250":
75		case "dir_cp1256":
76		case "dir_cp874":
77		case "dir_cp932":
78		case "dir_cp936":
79		case "dir_eucjp":
80		case "dir2_cp1252":
81		case "dir_cp1252":
82		case "dir_cp1251":
83		case "dir_big5":
84		case "dir":
85			create_verify_dir($prefix, $item, $cp);
86			break;
87
88		case "file":
89			create_verify_file($prefix, $item, "", $cp);
90			break;
91	}
92
93	return $prefix;
94}
95