I have a table where i have a TEXT column in utf8_unicode_ci format.
I also have a form where i can put multi language text into this field.
When i fetch each text from this column i want to show only 50 characters in length so i do the following:
$text = $rows["text"];
$text = mb_substr($text, 0, 50);
$text = htmlentities($text, ENT_COMPAT, 'UTF-8');
this fails to render non english characters and doesnt show anything, if i put mb_substr function below htmlentities it will show up but it will cut the text and show some &letter;&another;
any way i can solve this issue?
You can use mb_internal_encoding to change the char encoding to UTF-8, that might solve it.