Skip to content

Commit 79015b2

Browse files
committed
Add tests for UCS-2 text encoding
1 parent 34ef8f3 commit 79015b2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

ext/mbstring/tests/other_encodings.phpt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ echo "7bit done\n";
2020
var_dump(mb_convert_encoding("\x01\x00", "8bit", "UTF-16BE")); // codepoints over 0xFF are illegal for '8-bit'
2121
echo "8bit done\n";
2222

23+
24+
// UCS-2
25+
echo bin2hex(mb_convert_encoding("\xFF\xFE\x00\x30", "UTF-16BE", "UCS-2")), "\n";
26+
echo bin2hex(mb_convert_encoding("\xFE\xFF\x30\x00", "UTF-16BE", "UCS-2")), "\n";
27+
echo bin2hex(mb_convert_encoding("\x00\x30", "UTF-16BE", "UCS-2LE")), "\n";
28+
echo "UCS-2 done\n";
29+
2330
?>
2431
--EXPECT--
2532
string(3) "ABC"
@@ -28,3 +35,7 @@ string(3) "ABC"
2835
7bit done
2936
string(1) "%"
3037
8bit done
38+
3000
39+
3000
40+
3000
41+
UCS-2 done

0 commit comments

Comments
 (0)