Description
htmlentities() returns empty string when applied on certain characters, with encoding such as big5.
The following code:
<?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
PHP 8.5.4,
check with versions since 8.2+
Operating System
No response
Description
htmlentities() returns empty string when applied on certain characters, with encoding such as big5.
The following code:
(also here) : https://3v4l.org/BYPMD#v8.5.3
Resulted in this output:
But I expected this output instead:
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
Operating System
No response