How to remove zero width without joiner from a string?

I have one line in a PHP script

$ str = "इन रिकॉर्ड्स पर है सलमान की नजर, धूम -3 को पछाड़ेगी जय हो?";

and converting it from the code below:

$encoded_string = bin2hex(mb_convert_encoding($str, "UTF-16BE", 'UTF-8'));

Mobile device output:

इन रिकॉ (zero width is displayed here without a joiner) र्ड्स पर है सलमान की नजर, धूम -3 को पछाड़ेगी जय हो?

but getting Zero-Width Non-Joiner * ‌ * in the final release. How can I remove this object when converting a string after receiving the final output?

+3
source share
3 answers

found solution. Just replace the zero-width suffix from String and it will work.

 $str=str_replace('‌','',$str);

     **OR**  

 $str=str_replace('‌','',$str;
+1
source
$content = preg_replace( '/^[\pZ\pC]+|[\pZ\pC]+$/u', '', $content );
0
source
$content = preg_replace( "/\x{200c}/u", '', $content );
0
source

All Articles