Printable Version | Subscribe | Add to Favourites
New Topic New Reply
Author: Subject: Code tags and eating backslashes
MikeRJ

posted on 28/11/07 at 11:12 PM Reply With Quote
Code tags and eating backslashes

Would it be possible for an admin to fix the code tags? Currently it double spaces everything which is not very handy for ASCII diagrams etc.

Also, why does the forum eat backslashes even within code sections?

View User's Profile View All Posts By User U2U Member
Fozzie

posted on 28/11/07 at 11:24 PM Reply With Quote
Mike, only ChrisW does stuff with codes etc....

I can't say as I have noticed anything untoward from this end, but I will point Chris in the direction of your post next time we speak!

Fozzie





'Racing is Life!...anything before or after is just waiting'....Steve McQueen


View User's Profile E-Mail User View All Posts By User U2U Member
MikeRJ

posted on 28/11/07 at 11:31 PM Reply With Quote
Cheers Fozzie

As a quick test, start a post and put say ten back slashes in it, then click Preview Post. In the preview it will show only two backslashes, and in the original post there will only be 5 backslashes left. Each time you click preview (or post) it eats more of them

View User's Profile View All Posts By User U2U Member
Fozzie

posted on 28/11/07 at 11:35 PM Reply With Quote
You are right!

It ate 3 of them in one go!

It ate \\\\ (should be 8) ......

Fozzie





'Racing is Life!...anything before or after is just waiting'....Steve McQueen


View User's Profile E-Mail User View All Posts By User U2U Member
02GF74

posted on 29/11/07 at 08:01 AM Reply With Quote
I'd rather eat my colon than your backslashes
View User's Profile View All Posts By User U2U Member
martyn_16v

posted on 29/11/07 at 09:50 AM Reply With Quote
Backslashes are used as escape characters to help store special characters in a database (e.g \n is a newline, \t is a tab). All posts that get entered will have all of their special characters converted like this before they get stored on the forum database to try and stop people entering potentially harmful code within posts. When the post is then read back out of the database these special characters are then restored so the message should read properly, but unfortunately backslashes often get left behind






View User's Profile Visit User's Homepage View All Posts By User U2U Member
Fozzie

posted on 29/11/07 at 12:25 PM Reply With Quote
Thanks for that martyn!

As said, I don't 'do' codes..... so all gobbledegook to me

Doesn't sound too crucial to me, in 'normal' use of the site........

Fozzie





'Racing is Life!...anything before or after is just waiting'....Steve McQueen


View User's Profile E-Mail User View All Posts By User U2U Member
MikeRJ

posted on 29/11/07 at 12:59 PM Reply With Quote
quote:
Originally posted by martyn_16v
When the post is then read back out of the database these special characters are then restored so the message should read properly, but unfortunately backslashes often get left behind


I assumed it was an escape character problem, but the escape code for a backslash is two backslashes, so putting double the amount in *should* work. This all goes to pot if you do a preview though.

I also thought that anything in a [ code ] section was stored with no formatting conversion? I've certainly not encountered this particular issue on other forums.

View User's Profile View All Posts By User U2U Member
martyn_16v

posted on 29/11/07 at 04:32 PM Reply With Quote
Everything should be 'made safe', even if it's in a code tag, otherwise it may be possible for an attacker to enter SQL commands within a post. How it's implemented varies from forum to forum (and between programming languages). PHP has some built in functions to do this, they have their foibles but they work reasonably well, so the majority of forums that run on phpbb/vbulletin probably work fine. I do remember having to fiddle with a web wiz forum once (written in ASP) that did a similar thing to this, but it was so long ago I can't remember specifics.






View User's Profile Visit User's Homepage View All Posts By User U2U Member

New Topic New Reply


go to top






Website design and SEO by Studio Montage

All content © 2001-16 LocostBuilders. Reproduction prohibited
Opinions expressed in public posts are those of the author and do not necessarily represent
the views of other users or any member of the LocostBuilders team.
Running XMB 1.8 Partagium [© 2002 XMB Group] on Apache under CentOS Linux
Founded, built and operated by ChrisW.