1--TEST--
2Test iconv_get_encoding()/iconv_set_encoding() function : basic functionality
3--EXTENSIONS--
4iconv
5--INI--
6error_reporting=E_ALL & ~E_DEPRECATED
7input_encoding=ISO-8859-1
8iconv.internal_encoding=ISO-8859-1
9iconv.output_encoding=ISO-8859-1
10--FILE--
11<?php
12/*
13 * Test Basic functionality of iconv_get_encoding/iconv_set_encoding
14 */
15
16echo "*** Testing iconv_get_encoding()/iconv_set_encoding() : basic functionality ***\n";
17
18echo "--- Default get_encoding ---\n";
19var_dump(iconv_get_encoding());
20var_dump(iconv_get_encoding("input_encoding"));
21var_dump(iconv_get_encoding("output_encoding"));
22var_dump(iconv_get_encoding("internal_encoding"));
23var_dump(iconv_get_encoding("all"));
24
25echo "\n--- Altering encodings ---\n";
26var_dump(iconv_set_encoding("input_encoding", "UTF-8"));
27var_dump(iconv_set_encoding("output_encoding", "UTF-8"));
28var_dump(iconv_set_encoding("internal_encoding", "UTF-8"));
29
30
31echo "\n--- results of alterations ---\n";
32var_dump(iconv_get_encoding());
33var_dump(iconv_get_encoding("input_encoding"));
34var_dump(iconv_get_encoding("output_encoding"));
35var_dump(iconv_get_encoding("internal_encoding"));
36var_dump(iconv_get_encoding("all"));
37
38
39echo "Done";
40?>
41--EXPECT--
42*** Testing iconv_get_encoding()/iconv_set_encoding() : basic functionality ***
43--- Default get_encoding ---
44array(3) {
45  ["input_encoding"]=>
46  string(10) "ISO-8859-1"
47  ["output_encoding"]=>
48  string(10) "ISO-8859-1"
49  ["internal_encoding"]=>
50  string(10) "ISO-8859-1"
51}
52string(10) "ISO-8859-1"
53string(10) "ISO-8859-1"
54string(10) "ISO-8859-1"
55array(3) {
56  ["input_encoding"]=>
57  string(10) "ISO-8859-1"
58  ["output_encoding"]=>
59  string(10) "ISO-8859-1"
60  ["internal_encoding"]=>
61  string(10) "ISO-8859-1"
62}
63
64--- Altering encodings ---
65bool(true)
66bool(true)
67bool(true)
68
69--- results of alterations ---
70array(3) {
71  ["input_encoding"]=>
72  string(5) "UTF-8"
73  ["output_encoding"]=>
74  string(5) "UTF-8"
75  ["internal_encoding"]=>
76  string(5) "UTF-8"
77}
78string(5) "UTF-8"
79string(5) "UTF-8"
80string(5) "UTF-8"
81array(3) {
82  ["input_encoding"]=>
83  string(5) "UTF-8"
84  ["output_encoding"]=>
85  string(5) "UTF-8"
86  ["internal_encoding"]=>
87  string(5) "UTF-8"
88}
89Done
90