1

Topic: problems with html entities

I have < in a database (posts table, message field), but when this gets displayed, it is displayed as &lt;..

2

Re: problems with html entities

this is the problem: function pun_htmlspecialchars($str)

Re: problems with html entities

Hmm, what do you mean? You just posted < here and it works. It only fails in your forum?

"Programming is like sex: one mistake and you have to support it for the rest of your life."

4

Re: problems with html entities

no, there is a bug... when I converted phpBB into PunBB, there was < sign converted as < -- BUT, when it is displayed, it is not displayed as <, but rather as <, because < gets converted into &lt;

here's the fix:

function pun_htmlspecialchars($str)
{
    $str = preg_replace('/&(?!#[0-9]+);/s', '&', $str);
    $str = str_replace(array('<', '>', '"'), array('<', '>', '"'), $str);
    return $str;
}

Re: problems with html entities

That is the way it should be. If the database contains <, the forum should display just that, not the character the entity represents.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

6

Re: problems with html entities

ok, in that case, it's the *real problem* with phpBB -> PunBB conversion

Re: problems with html entities

Yes.

"Programming is like sex: one mistake and you have to support it for the rest of your life."