Closed henvic closed 8 years ago
Hi @henvic
Not sure why we should deal with it? This is just a color package. If you want to validate user input you should another package. Checkout https://godoc.org/ for packages that do these kind of things. Feel free to reopen if this is color related. Thanks!
Hey @fatih,
here are my arguments for a escape functionality on a[ny] coloring library:
I'm being really picky here, but let me give you this example:
Imagine you get some content (string) from a file on the Internet and output (print) it on the terminal. If you don't escape properly, you can get unexpected results on your screen (say, colored output when it should just show a set of characters together -- and probably colorizing other things later until your program terminates or another colorizing rule is applied on top of it).
That is, escaping is not only important for HTML | JSON | XML, but also for terminal as well. We usually don't do it because we just kind of don't care as no one is actively attacking others' CLI tools with evil rainbows.
Please let me know if you understand my point (I can do a short demo showing you how to reproduce the issue if you don't get it), and if you think it's relevant, missing something, etc.
This is useful for when you don't trust user input (say, it's something from the Internet).
Btw, escaping Windows colors is missing.