⚠ Be careful with unicode ⚠
Unicode has a lot of little known features. If you allow user generated content you should probably use a whitelist of acceptable symbols. Otherwise people may wreak havoc with right-to-left-overrides, zalgo, or most recently, color symbols.
21 comments
[ 3.9 ms ] story [ 69.8 ms ] thread不过说真的,你的代码应该支持阿拉伯语和其他左到右的语言,日语等。
Bùguò shuō zhēn de, nǐ de dàimǎ yīnggāi zhīchí ālābó yǔ hé qítā zuǒ dào yòu de yǔyán, rìyǔ děng.
ولكن في الحقيقة، يجب أن التعليمات البرمجية دعم اللغة العربية وغيرها من اللغات اليسار إلى اليمين، اليابانية، الخ
That was a RTL override character. Seems to have had no effect. Interestingly however, it seems HN gave me 0 points to start instead of 1.
It's a good talk, I suggest you to watch. Here is a video
http://m.youtube.com/watch?v=ksnuZfj9Lx0
As for a whitelist, it sounds like an incredibly huge effort to write a good one. Telling me I should do it without commenting on whether anyone else has tried and succeeded or failed leaves me where I was before reading this post. I was already thinking "boy, Unicode has some weird stuff in it. Wonder what I should do about it?"
whitelist OR style="overflow:hidden" (http://jsbin.com/zekar/1) OR something else?