Using the new php 5.4 constant ENT_DISALLOWED in htmlentities

There is a line that I am trying to output to htmlencoded in a way, and the function always returns an empty line. htmlentities()

I know exactly why he does it. Well, I do not run PHP 5.4. I have the latest PHP 5.3 installed.

The question is, how can I htmlencode a string that has the wrong sequence of code blocks.

According to the manual, ENT_SUBSTITUTEthis is the way. But this constant is not defined in PHP 5.3.X.

I have done this:

if (!defined('ENT_SUBSTITUTE')) {
    define('ENT_SUBSTITUTE', 8);
}

still no luck. htmlentitiesstill returns an empty string.

I wanted to try ENT_DISALLOWEDinstead, but I cannot find its corresponding long value for it.

So my question is two folded

  • What is the constant value of PHP 5.4 ENT_DISALLOWED?

  • , , UTF-8 ( ), ? - , , htmlentities() .

+5
2

, htmlentities() PHP 5.3 ENT_SUBSTITUTE, ( ) ENT_IGNORE. :

, .

, . .

. UTF-8, htmlspecialchars() htmlentities(). -, , , Windows-1252. , (PHP 5.3):

htmlentities($string, ENT_QUOTES, $encoding = 'Windows-1252');

, , $string Windows-1252 (CP1252). , . , , iconv mb_string.

+3

, 5.4.0. , 5.4.0. , htmlentities .

, PHP- .

+2

All Articles