a thoughtful web.
Good ideas and conversation. No ads, no tracking.   Login or Take a Tour!
comment
syzo  ·  3453 days ago  ·  link  ·    ·  parent  ·  post: Hubski Update: Welcome rob05c! + more tag info

    Sanatizing it often causes its own problems including losing things like spaces, or having a ridiculous regex that depends on knowing what the user intends on inputting. For example are we going to sanitize for "? Well what about “ or ❝ ?

Just the bare minimum, basically anything that would come out as HTML or scripts, so you can't do <b>this</b> or <?php echo("this"); ?> or <script>alert("this");</script>

So just turn "<" into "&lt;" and ">" into "&gt;" and you should be good to go? You need to make sure you can't SQL inject, too (the issue with those quotation characters, I imagine) - I obviously haven't thought of this too far and I'm sure there's a bunch of issues like that. There usually are libraries to do input sanitizing, aren't there?

Then, Markdown can handle the rest as normal, which sounds like it's the harder issue with specifying a grammar and building a lexer+parser off it. Markdown would probably ignore things like “ or ❝ or 🐐 and treat them as normal characters.

    🐐 here is an unsanitized goat.

Get it together, goat. Wash your hands more often!

Saw the goat on my phone but not on my desktop browser :(