Posted by Rik on 10/15/22 11:57
jl wrote:
> jl wrote:
>>> From the php manual I copied and pasted this example:
>>
>> <?php
>> $str = "A 'quote' is <b>bold</b>";
>>
>> // Outputs: A 'quote' is <b>bold</b>
>> echo htmlentities($str);
>>
>> // Outputs: A 'quote' is <b>bold</b>
>> echo htmlentities($str, ENT_QUOTES);
>>>
>>
>> However, when I run it in my browser, the output is wrong:
>>
>> A 'quote' is <b>bold</b>A 'quote' is <b>bold</b>
>>
>> the < is not converted to < (no conversion is taking place)
>>
>> Is there a configuration that would disable htmlentities?
>> Does anyone have any idea as to what would cause htmlentities to not
>> work?
>>
>> Thanks!
>> jl
>
> I figured it out. The browser was reconverting the string.
Not exactly. The browser was interpreting it as the aplicable characters
instead of HTML tags, which is what it is used for.
If you want to display <, you'll have to have &lt; in yout code.
--
Rik Wasmus
[Back to original message]
|