Skip to content

Instantly share code, notes, and snippets.

@QROkes
Created January 17, 2016 15:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save QROkes/c713e2ed0f124c79010f to your computer and use it in GitHub Desktop.
Save QROkes/c713e2ed0f124c79010f to your computer and use it in GitHub Desktop.
Convert Unicode Escape Sequences to UTF-8.
// Convert Unicode Escape Sequences to UTF-8.
$content = preg_replace_callback('/\\\\u([0-9a-fA-F]{4})/', function ($match) {
return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE');
}, $content);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment