Julianto
Julianto

Reputation: 51

PHP Htmlentities - double encoded

What condition we use to decide when to set double encoded is true or false? What php settings variable we can use to decide it?

For Russian character, it should use double encoded true then it will display the character. But if double encoded is false, the string will be displayed as empty. What condition we use to set double encoded true or false?

Upvotes: 3

Views: 2289

Answers (1)

alex
alex

Reputation: 490213

You can change that with the 4th argument. Set it to FALSE to not double encode.

$str = 'Hot & Cold and On & Off';

var_dump(htmlentities($str, ENT_COMPAT, 'UTF-8', FALSE));

Output

string(31) "Hot & Cold and On & Off"

CodePad.

Upvotes: 4

Related Questions