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

Popular posts from this blog

asp.net - Change the driver in the connection string to a data source in VB.Net -

Getting started consuming web services in a Ruby on Rails 3 application -

objective c - iPhone and it's wireless area -