Friday, August 3, 2018

php - Question mark( �) displaying instead of each Bengali unicode character. How to fix it?



The problem is confusing,such as,



When I am trying to display a Bengali unicode word,'কলম' with this



 $data=$_POST['data'];

echo $data;


Then it displays the word 'কলম' properly as I wanted,



But when I split the word character by character with this



    for($i=0;$i<3;$i++)
{
echo $data[$i];

echo "+";
}


Then it display '�+�+�+' instead of displaying like this 'ক+ল+ম+'.



How to solve this problem .Thank you.



For information , I have declared charset utf-8 in head.





< meta http-equiv= " Content-Type " content= " text/html;
charset=utf-8 " />



Answer



Use mb_substr($data, $i, 1) instead. You are using a multi-byte string.


No comments:

Post a Comment

plot explanation - Why did Peaches&#39; mom hang on the tree? - Movies &amp; TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...