Implements double_encode in Htmlspecialchars

Implements double_encode check at '&' char when iterating over string. Identifies utf-8 entities by default (PHP 5.4+).
 + Fixes #1857