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 | |
// Works Perfict | |
function uni2html($string){ | |
//preg_replace(): Compilation failed: PCRE does not support \L, \l, \N{name}, \U, or \u at offset 1. | |
//so can't use $string = preg_replace('/\\u([0-9A-Za-z]+)/', '&#x$1;', $string); directly. | |
$string = explode('\\', $string); | |
$string = implode('%', $string); | |
$string = preg_replace('/%u([0-9A-Za-z]+)/', '&#x$1;', $string); | |
return html_entity_decode($string, ENT_COMPAT, 'UTF-8'); |