Replace Unicode With Actual Data In Php
I want to replace unicode \u00a0 with actual data in php. Example : 'Sort By\u00a0-\u00a0);
return preg_replace_callback('/\\\\u([0-9a-fA-F]{4})/u', create_function('$match', 'return mb_convert_encoding(pack("H*", $match[1]), '.var_export($encoding, true).', "UTF-16BE");'), $str);
}
echo unicodeString($str);
//<b>Sort By - </b><a href="http://pagalworld.com/files/9704/Dil Dhadakne Do (2015) Mp3 Songs/atoz/1.html">A to Z | </a><a href="http://pagalworld.com/files/9704/Dil Dhadakne Do (2015) Mp3 Songs/recent/1.html">Recently Added | </a><a href="http://pagalworld.com/files/9704/Dil Dhadakne Do (2015) Mp3 Songs/downloads/1.html">Most Downloaded</a>
DEMO:
If you just need to replace a singleescape sequence
, use:
$str = str_replace("\u00a0", " ", $str);
echo $str;
<b>Sort By - </b><a href="http://pagalworld.com/files/9704/Dil Dhadakne Do (2015) Mp3 Songs/atoz/1.html">A to Z | </a><a href="http://pagalworld.com/files/9704/Dil Dhadakne Do (2015) Mp3 Songs/recent/1.html">Recently Added | </a><a href="http://pagalworld.com/files/9704/Dil Dhadakne Do (2015) Mp3 Songs/downloads/1.html">Most Downloaded</a>
Post a Comment for "Replace Unicode With Actual Data In Php"