Skip to content

Instantly share code, notes, and snippets.

@delonnewman
Created November 10, 2016 06:06
Show Gist options
  • Save delonnewman/fd642502d956156e545f4c8a6685c82e to your computer and use it in GitHub Desktop.
Save delonnewman/fd642502d956156e545f4c8a6685c82e to your computer and use it in GitHub Desktop.
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');
}
@delonnewman
Copy link
Author

• - This was the character that was giving me trouble.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment