I am having problem with converting Unicode characters to human readable text in php.
I have string of unicode characters like following
$chars = "\u1006\u1092\u1019\u1021\u102c\u101b\u1036\u102f \u1019\u1002\u1062\u1007\u1004\u1039\u1038 (\u1042\u1040\u1041\u1046 \u1007\u1030\u101c\u102d\u102f\u1004\u1039)";
If I echo like this
echo $chars
It will not convert to human readable string. But If I echo like this
$text = '<script type="text/javascript">
document.write("\u1006\u1092\u1019\u1021\u102c\u101b\u1036\u102f \u1019\u1002\u1062\u1007\u1004\u1039\u1038 (\u1042\u1040\u1041\u1046 \u1007\u1030\u101c\u102d\u102f\u1004\u1039)");
</script>';
echo $text;
It can print the human readable string like below.
Using that way I can show the result to user. But the problem is I want to store as human readable string in database. So I can do other operation with that string. So my questions are
- How can I convert that Unicode characters into human readable string in PHP?
OR
- How can I assign the result of the JavaScript as in second method into a string in php?
Here is the same question I asked long ago, Converting Unicode character to text in PHP is not working.