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