I am using the following function in PHP to trim some unwanted characters.
$inputString = "आनन्द मठ";
trim(html_entity_decode($inputString), " \t\n\r\0\x0B\xC2\xA0");
The above code is working fine for all cases but in one input string (आनन्द मठ
) it is converting it to आनन्द म�
. It has a unwanted �. Also happening for परेटो- श्रेष्ठ
converted to परेटो- श्रेष्�
.