Created
May 10, 2014 11:50
-
-
Save bladeofsteel/5a07dc19db119973141b to your computer and use it in GitHub Desktop.
Unicode characters to html entities
This file contains hidden or 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
<?php | |
function unicode_escape_sequences($str) { | |
$working = json_encode($str); | |
$working = preg_replace('/\\\u([0-9a-z]{4})/', '&#x$1;', $working); | |
return json_decode($working); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment