PDA

View Full Version : Bug: 2.3.0-prior: Oh html standards, how vB developers loathe thee...


Paul
Fri 1st Aug '03, 10:43am
vBulletin 2 fails to properly use "&" instead of "&" This happens all over the code. Everywhere. It's invalid. It sucks. Someone was lazy. I've complained before, but this was not going to be fixed.

Up until today, I thought this only affected the validity of the doctype, however, as I post the pronounciation of a word in my message, I note that the "&lt" has converted itself into a "<"

How can this be fixed? (as if 2.3.x, the officially supported product here will ever see another bug-fix release in our lifetime). Convert the "&" symbol, which per HTML standards should never appear by itself, into "&amp;", the proper way of displaying an ampersand, before displaying posts.

I won't bother posting a fix here. The bug tracker doesn't accept entries for vB2. Apparently you don't care, so why the effort on my part?

Anyone else seeing this quirk now knows why.

Paul
Tue 5th Aug '03, 7:30am
This raises the question whether or not vbulletin users want to recognize &<stuff>; as html markup or as valid ways to post information. When posts are htmlspecialchars()'ed, non-standard things are converted into their ascii codes. Converting the & will cause things like "…" to start appearing in posts. I'm guessing this is why the amp conversion was removed at some point.

A new option could be created to allow these symbols in posts--in that case only convert the ampersand when the symbol isn't valid (it should start with a & and end with a semi-colon). It appears that IE will render codes that neglect to end with a semi-colon.. perhaps this is part of the quirks mode? For now, I'm adding a regex that checks to ensure the codes are valid before rendering them appropriately to allow codes posted by international users to appear in messages.

Paul
Tue 5th Aug '03, 9:12am
I've chosen to use the following:

$bbcode=preg_replace("/&(?![#a-z0-9]+;)/i","&amp;",$bbcode);