But I don’t think that should be the issue anyway - I’d like for instance the chr(128) character to be encoded as the entity “€”. But the funny characters are present in the source code for the page too, and not the entity.
“Extended ASCII” is vague. The characters that aren’t working are actually in Microsoft’s cp1252/Windows-1252 charset, so you need to pass “cp1252” for the charset parameter to htmlentities(). By default, htmlentities() uses “ISO-8859-1,” which is without Microsoft’s extensions (the characters that you are having issues with). Both cp1252 and ISO-8859-1 can be considered “extended ASCII,” and arguably many more charsets can be too.