htmlspecialchars and htmlentities not working.

robray

New Member
Messages
11
Reaction score
0
Points
0
hi,

I would like to know why htmlspecialchars and htmlentities are not working.

These examples, should produce the results indicated. They don't.

$new = htmlspecialchars("<a href='test'>Test</a>", ENT_QUOTES);
echo $new;
// Should output: &lt;a href='test'&gt;Test&lt;/a&gt;

$str = "A 'quote' is <b>bold</b>";
echo htmlentities($str, ENT_QUOTES);
// should output: A 'quote' is &lt;b&gt;bold&lt;/b&gt;


prints:

<a href='test'>Test</a> A 'quote' is <b>bold</b>

clearly, neither input string have been touched by these functions.

Is this a temporary issue that will be resolved ?

Is this a permanent feature that will never be resolved ?

Best wishes

Robray.
 

AngusThermopyle

Active Member
Messages
319
Reaction score
52
Points
28
Remember, you are viewing it in a browser

htmlentities( '>') outputs &gt;

&gt; , sent to the browser , will display as >

Or maybe I misunderstood your post.
 
Last edited:

robray

New Member
Messages
11
Reaction score
0
Points
0
Remember, you are viewing it in a browser

htmlentities( '>') outputs &gt;

&gt; , sent to the browser , will display as >

Or maybe I misunderstood your post.

No, i'd say you understood my question, and my confusion, perfectly.

Thanks for your reply :)

Best wishes

Robray.
 
Top