Not encoding already encoded items with htmlentities
html, php
Solution
The third parameter of `htmlentities` is the charset parameter; the fourth parameter is the double_encode parameter. So try this:
$out = htmlentities($string, ENT_NOQUOTES, ini_get('default_charset'), false);
Problem
I have a string that looks something like this: ``` Bürstner ``` When I use htmlentities() on it, I set the `double encode` param to false, but it still ends up re-encoding the ` ` into ` ` I'm using this to encode: ``` $out = htmlentities($string,ENT_NOQUOTES, 0); ``` Am I somehow misunderstanding how this works? The desired output is to encode the umlaut u, but leave the existing nbsp entities alone (this is just an example, there are MANY entities in a very long document already). ** EDIT ** Since this seems unclear, ORIGINAL STRING: `Bürstner ` DESIRED OUTPUT: `Bürstner ` The existing entities should be left alone.