3

Fixing the htmlspecialchars UTF-8 Error

Posted (Updated ) in PHP

If you’ve ever come across the infuriating error

htmlspecialchars(): Invalid multibyte sequence in argument

I have a simple solution for you: Turn display_errors on in your php.ini file!

It turns out there’s a weird bug that doesn’t appear to be getting fixed any time soon that causes htmlspecialchars() to display this error only when display_errors is set to Off.

See this post for further details and a very big thank you to the Andy Young for writing it and saving me (and I’m sure many others) alot of time!