Skip to content

Commit 34ef8f3

Browse files
committed
Add tests for '7bit' and '8bit' text encodings in mbstring
1 parent 97f8495 commit 34ef8f3

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
--TEST--
2+
Test of oddball text encodings which are not tested elsewhere
3+
--EXTENSIONS--
4+
mbstring
5+
--SKIPIF--
6+
<?php
7+
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
8+
?>
9+
--FILE--
10+
<?php
11+
mb_substitute_character(0x25);
12+
13+
// "7bit". This is not a real text encoding.
14+
var_dump(mb_convert_encoding("ABC", "7bit", "ASCII"));
15+
var_dump(mb_convert_encoding("\x80", "7bit", "ASCII"));
16+
var_dump(mb_convert_encoding("ABC", "8bit", "7bit"));
17+
echo "7bit done\n";
18+
19+
// "8bit"
20+
var_dump(mb_convert_encoding("\x01\x00", "8bit", "UTF-16BE")); // codepoints over 0xFF are illegal for '8-bit'
21+
echo "8bit done\n";
22+
23+
?>
24+
--EXPECT--
25+
string(3) "ABC"
26+
string(1) "%"
27+
string(3) "ABC"
28+
7bit done
29+
string(1) "%"
30+
8bit done

0 commit comments

Comments
 (0)