Skip to content

Instantly share code, notes, and snippets.

@AnowarCST
Last active July 28, 2016 11:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save AnowarCST/22bc4ad7474348287037 to your computer and use it in GitHub Desktop.
Save AnowarCST/22bc4ad7474348287037 to your computer and use it in GitHub Desktop.
convertUTF8
public static function convertUTF8($string)
{
//$sampleString = 'u0986u09a8u09c7u09beu09dfu09beu09b0 u09b9u09c7u09beu09b8u09beu0987u09a8';
$string = preg_replace('/u([0-9a-fA-F]+)/', '&#x$1;', $string);
return html_entity_decode($string, ENT_COMPAT, 'UTF-8');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment