public function escapeHtml($string, $flags = null, $encoding = null)
    {
        if (null === $flags) {
            $flags = ENT_QUOTES | ENT_HTML5;
        }

        $flags |= ENT_SUBSTITUTE;

        if (null === $encoding) {
            $encoding = $this->encoding;
        }

        return htmlspecialchars((string) $string, $flags, $encoding);
    }