[php-src] Issue #21612: htmlentities() returns an empty string

From: Date: Thu, 02 Apr 2026 20:36:15 +0000
Subject: [php-src] Issue #21612: htmlentities() returns an empty string
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-251890@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/21612 Author: exakat ### Description htmlentities() returns empty string when applied on certain characters, with encoding such as big5. The following code: ```php <?php $string = "éù"; var_dump( htmlentities($string, ENT_QUOTES, "big5")); $string = "Café & 'quotes' and € euro"; var_dump( htmlentities($string, ENT_QUOTES, "big5")); ``` (also here) : https://3v4l.org/BYPMD#v8.5.3 Resulted in this output: ``` Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in /in/97KgC on line 4 string(4) "éù" 29 Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in /in/97KgC on line 8 string(0) "" ``` But I expected this output instead: ``` string(4) "éù" string(29) "Café & 'quotes' and € euro" ``` With the first string, nothing happens, but the incoming is returned. With the second string, something happens, and the whole string is removed. That is excessive. ### PHP Version ```plain PHP 8.5.4, check with versions since 8.2+ ``` ### Operating System _No response_

« previous php.bugs (#251890) next »