ID:1884934
 
(See the best response by Kaiochao.)
How do you prevent people from using newline ("\n") in chat?
You could replace all of them with something else.
Nothing like html_encode() that just shows the text as is, and doesn't count \n as a newline?
Best response
If you had a function that could scan through a string and replace every instance of some string with another string, you could disable every \n in the original string.

For instance, you could use str_replace() from here like so:
mob/verb/say(t as text)
t = str_replace(t, "\n", "\\n")
world << "[src]: [html_encode(t)]"
The above code should replace each \n with an escaped \n that will show up in the output.
Thanks, very useful. Was secretly hoping for an html_encode that also disables all text macros, but \n is the only dangerous text macro that players can use so this'll be great.
Instead of replacing, I'd just go with the easier route and cut off the text there.

var/i = findtextEx(t, "\n")
if(i) t = copytext(1,i)
t = html_encode(t) // lose other macros too