-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for '7bit' and '8bit' text encodings in mbstring
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--TEST-- | ||
Test of oddball text encodings which are not tested elsewhere | ||
--EXTENSIONS-- | ||
mbstring | ||
--SKIPIF-- | ||
<?php | ||
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); | ||
?> | ||
--FILE-- | ||
<?php | ||
mb_substitute_character(0x25); | ||
|
||
// "7bit". This is not a real text encoding. | ||
var_dump(mb_convert_encoding("ABC", "7bit", "ASCII")); | ||
var_dump(mb_convert_encoding("\x80", "7bit", "ASCII")); | ||
var_dump(mb_convert_encoding("ABC", "8bit", "7bit")); | ||
echo "7bit done\n"; | ||
|
||
// "8bit" | ||
var_dump(mb_convert_encoding("\x01\x00", "8bit", "UTF-16BE")); // codepoints over 0xFF are illegal for '8-bit' | ||
echo "8bit done\n"; | ||
|
||
?> | ||
--EXPECT-- | ||
string(3) "ABC" | ||
string(1) "%" | ||
string(3) "ABC" | ||
7bit done | ||
string(1) "%" | ||
8bit done |