Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I enter angle brackets into an HTML form textbox so they won't be 'sanitized' away

No, I am not trying to do anything evil.

There is a discussion website that I frequent that uses a textbox similar to what I am typing in now except that it had no accommodations to click for italics, bold, etc. People figured out that you could just add the html tags to the text being submitted and things would be formatted correctly. Then some people abused the system and started inserting IMG tags and such.

The response of the website was to use a meat cleaver instead of scalpel. They seem to pre-process and strip anything with angle brackets. This not only excludes the html tags that bugged them but every html code including new paragraphs. So now every submission just looks like a massive slab of text without any formatting at all. It is clear that they are just blindly stripping anything within angle brackets because even something like

It is nice <to see you> today.

ends up being

It is nice today.

So my question is: is there a way to escape the angle brackets so they get passed the pre-processing attempts. IOW they are doing something like:

if (char == '<')

I would like something like "\asciicode" that would get past the censor module but be interpreted correctly by whatever used to normally interpret the html after that.

Again, I just want my NEWLINES back!

like image 367
Translucent Pain Avatar asked Dec 08 '25 21:12

Translucent Pain


1 Answers

You want to change < to &lt; and > to &gt;

Also, " to &quot; and & to &amp;

like image 159
Rocky Pulley Avatar answered Dec 11 '25 22:12

Rocky Pulley



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!