Skip to content

Commit

Permalink
Add tests for UCS-2 text encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdowad committed Aug 30, 2021
1 parent 34ef8f3 commit 79015b2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ext/mbstring/tests/other_encodings.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ echo "7bit done\n";
var_dump(mb_convert_encoding("\x01\x00", "8bit", "UTF-16BE")); // codepoints over 0xFF are illegal for '8-bit'
echo "8bit done\n";


// UCS-2
echo bin2hex(mb_convert_encoding("\xFF\xFE\x00\x30", "UTF-16BE", "UCS-2")), "\n";
echo bin2hex(mb_convert_encoding("\xFE\xFF\x30\x00", "UTF-16BE", "UCS-2")), "\n";
echo bin2hex(mb_convert_encoding("\x00\x30", "UTF-16BE", "UCS-2LE")), "\n";
echo "UCS-2 done\n";

?>
--EXPECT--
string(3) "ABC"
Expand All @@ -28,3 +35,7 @@ string(3) "ABC"
7bit done
string(1) "%"
8bit done
3000
3000
3000
UCS-2 done

0 comments on commit 79015b2

Please sign in to comment.