Perhaps because the entity is a non-UTF8 character?
Here’s what esc_html()
does:
function esc_html( $text ) {
$safe_text = wp_check_invalid_utf8( $text );
$safe_text = _wp_specialchars( $safe_text, ENT_QUOTES );
return apply_filters( 'esc_html', $safe_text, $text );
}
If not that, then it’s getting sanitized when filtered by _wp_specialchars()
, which does double-encoding(by default,no) and all sorts of things.
For reference:
1) esc_html()
in source
2) _wp_specialchars()
in source