Sanitizing input for display in view when using simple_format
Posted
by Eric
on Stack Overflow
See other posts from Stack Overflow
or by Eric
Published on 2010-03-14T01:49:46Z
Indexed on
2010/03/14
1:55 UTC
Read the original article
Hit count: 378
Hi,
I'm trying to figure out the right way to display comments such that newlines and links are displayed. I know that usually, you should display user-inputs only when escaping html with h(). That of course won't display newlines or links, so I found the simple_format and auto_link methods.
What I am now doing is: simple_format(santize(auto_link(comment.text)))
Is this the right way to do this, and is it still safe from XSS attacks?
Thanks! Eric
© Stack Overflow or respective owner