Skip to content

Commit aba051e

Browse files
Add test for surrogate half encoding
1 parent ff0a8ac commit aba051e

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
// Surrogate pairs are non-well-formed UTF-8 - however, it is sometimes useful
4+
// to be able to produce these (e.g. CESU-8 handling)
5+
6+
var_dump(bin2hex("\u{D801}"));
7+
var_dump(bin2hex("\u{DC00}"));
8+
var_dump(bin2hex("\u{D801}\u{DC00}")); // CESU-8 encoding of U+10400
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
string(6) "eda081"
2+
string(6) "edb080"
3+
string(12) "eda081edb080"

0 commit comments

Comments
 (0)