summaryrefslogtreecommitdiff
path: root/ext/mbstring/tests
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2002-08-04 14:20:11 +0000
committerMarcus Boerger <helly@php.net>2002-08-04 14:20:11 +0000
commit77abd9d55a38d3f68e25a55cad33d4b192fd094b (patch)
tree88ba051cb1d043917f5e46181ec57cbc4c840106 /ext/mbstring/tests
parentf2f70b5ddaa6a9e688c34c7f20399173a8eca0f6 (diff)
downloadphp-git-77abd9d55a38d3f68e25a55cad33d4b192fd094b.tar.gz
-New encoding/decoding HTML-ENTITIES.
#This allows to enforce named and numeric entities in output. #Example:CMS that reads UTF8 or ISO-8859-1 but exports HTML in ASCII. #Using mbstring.http_output=HTML-ENTITIES users receive entities which #can displayed correctly independant of any brwoser side encoding. @New mbstring encoding/decoding HTML-ENTITIES. (marcus)
Diffstat (limited to 'ext/mbstring/tests')
-rw-r--r--ext/mbstring/tests/020.phpt33
1 files changed, 33 insertions, 0 deletions
diff --git a/ext/mbstring/tests/020.phpt b/ext/mbstring/tests/020.phpt
new file mode 100644
index 0000000000..cc13d9e3ff
--- /dev/null
+++ b/ext/mbstring/tests/020.phpt
@@ -0,0 +1,33 @@
+--TEST--
+HTML input/output
+--SKIPIF--
+<?php
+ ini_set('include_path','.');
+ include('skipif.inc');
+?>
+--INI--
+arg_separator.input="x"
+error_reporting=0
+mbstring.http_input=HTML-ENTITIES
+mbstring.internal_encoding=UTF8
+mbstring.http_output=HTML-ENTITIES
+mbstring.encoding_translation=On
+--FILE--
+<?php
+// enable output encoding through output handler
+ob_start("mb_output_handler");
+// &#64... are must be decoded on input these are not reencoded on output.
+// If you see &#64;&#65;&#66; on output this means input encoding fails.
+// If you do not see &auml;... on output this means output encoding fails.
+// Using UTF-8 internally allows to encode/decode ALL characters.
+// &128... will stay as they are since their character codes are above 127
+// and they do not have a named entity representaion.
+?>
+<?php echo mb_http_input('l').'>'.mb_internal_encoding().'>'.mb_http_output();?>
+
+<?php mb_parse_str("test=&&;&&#64;&#65;&#66;&#128;&#129;&#130;&auml;&ouml;&uuml;&euro;&lang;&rang;");
+echo "test='$test'";
+?>
+--EXPECT--
+HTML-ENTITIES>UTF-8>HTML-ENTITIES
+test='&&;&@AB&#128;&#129;&#130;&auml;&ouml;&uuml;&euro;&lang;&rang;' \ No newline at end of file