Skip to content

Commit 7472c82

Browse files
committed
Add tests for UCS-4 text conversion
1 parent 79015b2 commit 7472c82

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

ext/mbstring/tests/other_encodings.phpt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,22 @@ 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-
2423
// UCS-2
2524
echo bin2hex(mb_convert_encoding("\xFF\xFE\x00\x30", "UTF-16BE", "UCS-2")), "\n";
2625
echo bin2hex(mb_convert_encoding("\xFE\xFF\x30\x00", "UTF-16BE", "UCS-2")), "\n";
2726
echo bin2hex(mb_convert_encoding("\x00\x30", "UTF-16BE", "UCS-2LE")), "\n";
2827
echo "UCS-2 done\n";
2928

29+
// UCS-4
30+
echo bin2hex(mb_convert_encoding("\xFF\xFE\x00\x00\x00\x30\x00\x00", "UTF-16BE", "UCS-4")), "\n";
31+
echo bin2hex(mb_convert_encoding("\x00\x00\xFE\xFF\x00\x00\x30\x01", "UTF-16BE", "UCS-4")), "\n";
32+
echo bin2hex(mb_convert_encoding("\x02\x30\x00\x00", "UTF-16BE", "UCS-4LE")), "\n";
33+
echo bin2hex(mb_convert_encoding("\x00\x00\x30\x03", "UTF-16BE", "UCS-4BE")), "\n";
34+
35+
mb_substitute_character("long");
36+
echo mb_convert_encoding("\x01\x02\x03", "UTF-8", "UCS-4"), "\n";
37+
echo "UCS-4 done\n";
38+
3039
?>
3140
--EXPECT--
3241
string(3) "ABC"
@@ -39,3 +48,9 @@ string(1) "%"
3948
3000
4049
3000
4150
UCS-2 done
51+
3000
52+
3001
53+
3002
54+
3003
55+
BAD+20300
56+
UCS-4 done

0 commit comments

Comments
 (0)