htmlspecialchars(): Invalid multibyte sequence in argument

Hi just a quick tip for us noobies.

If you get this error,

htmlspecialchars(): Invalid multibyte sequence in argument

There are 3 things that helped me.

  1. Make sure you file is saved in UTF-8 most decent editors will give you this option.

  2. Make sure your Database table is saved UTF-8 as well.

  3. Finally and this is where i tripped myself up for a day is trying to display the field in a view so remove the field from the View attributes and the page will render correctly for you. To display the file you need to follow this tutorial.

Inserting a Blob into a database.

Just something that might help someone else.

Thanks

Ibecake

Thank you!!

The use of substr instead of mb_substr tripped me into this error. In short: if you use UTF-8, use mb_substr.