How can Z͎̠͗ͣḁ̵͙̑l͖͙̫̲̉̃ͦ̾͊ͬ̀g͔̤̞͓̐̓̒̽o͓̳͇̔ͥ text be prevented?

前端 未结 5 1110
独厮守ぢ
独厮守ぢ 2020-12-25 13:48

I\'ve read about how Zalgo text works, and I\'m looking to learn how a chat or forum software could prevent that kind of annoyance. More precisely, what is the complete set

5条回答
  •  伪装坚强ぢ
    2020-12-25 14:42

    You can get rid off Zalgo text in your application using strip-combining-marks by Mathias Bynens.

    The module strip-combining-marks is available for browsers (via Bower) and Node.js applications (via npm).

    Here is an example on how to use it with npm:

    var stripCombiningMarks = require("strip-combining-marks");
    var zalgoText = 'U̼̥̻̮͍͖n͠i͏c̯̮o̬̝̠͉̤d͖͟e̫̟̗͟ͅ';
    var stripptedText = stripCombiningMarks(zalgoText); // "Unicode"
    

提交回复
热议问题