Created
November 10, 2016 06:06
-
-
Save delonnewman/fd642502d956156e545f4c8a6685c82e to your computer and use it in GitHub Desktop.
This file contains 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
function escape_mb_chars($str) { | |
$first = preg_replace_callback('/\p{C}/u', function ($m) { | |
$char = current($m); | |
return substr(json_encode($char), 1, -1); | |
}, $str); | |
return rtrim($first, '\n'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
• - This was the character that was giving me trouble.