Why my php substr() shows obscure characters when cutting a text? -
I am using the substr ()
function to limit the characters in the strings. But sometimes, the output text contains some vague characters and question marks ...
The text that is "substred" is already UTF 8 encoded, and not html Is the way.
Thanks
Because you are cutting your characters in half.
Use multibyte character encoding like UTF-8, substr
simply calculates bytes, while mb_substr
calculates the characters.
Comments
Post a Comment