Added better support for encoding problems when escaping a string (available as of PHP 5.4)

From the PHP CHANGELOG:

The flag ENT_SUBSTITUTE makes invalid multibyte sequences be replaced by
U+FFFD (UTF-8) or &#FFFD; by htmlspecialchars and htmlentities. It is an
alternative to the default behavior, which just returns an empty string and to
ENT_IGNORE, which is a security risk. The behavior follows the recommendations
of Unicode Technical Report #36.
Merge pull request #78 from alquerci/security/escape

Added better support for encoding problems when escaping a string (available as of PHP 5.4)