·

photo credit: Ian Livesey via photopin cc

htmlspecialchars(): Invalid multibyte sequence in Magento

Tags: ,

So if you use the $this->escapeHtml() -method in a template in Magento, you might have come across an error something like this:

The problem here is a bug in older PHP versions where the combination of display_errors=off  and multibyte string throws this error (yeah that’s right…).
The fix is rather simple. Instead of directly passing your value to this method, utf8_encode()  it first:

That should get rid of this nasty little bugger!

How would you rate this article?

Leave a Reply