1--TEST--
2DOMDocument::$encoding - read/write tests (dom_document_encoding_read/dom_document_encoding_write)
3--CREDITS--
4Hans Zaunere
5# TestFest 2009 NYPHP
6--SKIPIF--
7<?php require_once('skipif.inc'); ?>
8--FILE--
9<?php
10
11require_once('dom_test.inc');
12
13$dom = new DOMDocument;
14$dom->loadXML($xmlstr);
15
16if( !$dom )
17{
18    echo "Error while parsing the document\n";
19    exit;
20}
21
22echo "Empty Encoding Read: {$dom->encoding}\n";
23
24$ret = $dom->encoding = 'NYPHP DOMinatrix';
25echo "Adding invalid encoding: $ret\n";
26
27$ret = $dom->encoding = 'ISO-8859-1';
28echo "Adding ISO-8859-1 encoding: $ret\n";
29echo "ISO-8859-1 Encoding Read: {$dom->encoding}\n";
30
31$ret = $dom->encoding = 'UTF-8';
32echo "Adding UTF-8 encoding: $ret\n";
33echo "UTF-8 Encoding Read: {$dom->encoding}\n";
34
35$ret = $dom->encoding = 'UTF-16';
36echo "Adding UTF-16 encoding: $ret\n";
37echo "UTF-16 Encoding Read: {$dom->encoding}\n";
38
39
40?>
41--EXPECTF--
42Empty Encoding Read:
43
44Warning: main(): Invalid Document Encoding in %s on line %d
45Adding invalid encoding: NYPHP DOMinatrix
46Adding ISO-8859-1 encoding: ISO-8859-1
47ISO-8859-1 Encoding Read: ISO-8859-1
48Adding UTF-8 encoding: UTF-8
49UTF-8 Encoding Read: UTF-8
50Adding UTF-16 encoding: UTF-16
51UTF-16 Encoding Read: UTF-16
52