Prevent insertion of Zalgo Text into Inputs

2

I have a Aplicação Web that has a user registry, I would like to know how do I prevent the user from sending as a name, email (cadastral data) a Zalgo Text .

  

Zalgo Example Text:

̵̵̵̵̵̴̷̷̢̢̢̢̢̡̢̢̥͍̫̻͚̦͖͇͖̩͙͖̩͙̼̙̳̼̙̳̼̙̳̟̗̹̻̜͕̼̙̳̼̙̳̫̻̮̤̫̫̌ͪ̇ͤ̑̐͋̾͐͑ͬ̄̿̍͐͑ͬ̄̿̍̒̄ͥ̋̐̒̄ͥ̋̐̒̄ͥ̋̐ͣ̐ͤͤ͒̒̄ͥ̋̐̒̄ͥ̋̐̿̆̊ͤͨ̏ͤͧͤͨ̏ͤͧ̍͆͑̈̕̚̚͘҉͍̤̘͔̹̭̍͆͑̈͢҉͍̤̘͔̹̭̍͆͑̈͢҉͍̤̘͔̹̭̍͆͑̈͢҉͍̤̘͔̹̭̍͆͑̈͢҉͍̤̘͔̹̭͢ ̥̮̘ͨ̄͢S̯̮̖͒.̥̮̘ͨ̄͢ B. ̝̥̰͋ͬ̋͛͑̚W̶̹̹̣̟͕ͪͤ̽i̳̪͉͇͇̟̇ͧ̾ͭ̿̆ͯ͡t̬̪̬̑̿͊͊̚h̋͑̈̇͋҉̴͖̜o̴̠̭̯̫̽ͨṳ̡̟͕̝̦͓͖̪̇͢t̬̙̖̝͈͔̻͛͊ ̵̛̗̝̝̰̫̞̠̙̽̄̊͆o̺̮͆ͯ͊͑ͭ̚̕ṙ̶̟̺̜̺̻̘̰͊ͮ͡ḋ̢̰ͦͥe̛̩͍̯̍ͭͩͤͦ̚r͍̾ͯ̊͛͡.̮̙͙̠̦̜̳̋̓ͩ͒̓̒͜͝ ̷͋͢͏̬̤̼T̸̯̞̥ͤ̽͛̈̚͜ȟ̨̌͋͏͚̪̩͚̺͖̠é̻̰̞̣̍̕͟ ̧̩͔̥̘͓̘̽͑̏ͣ͑̓͝N̬̙͈̗͍̣̻̓ͨͫͮ͘͜͡e͍̜̠͓̹̙͓͑͡z̵̙̦̳͓ͭ̑ͮp͒͐҉̹͎̯̰͜ȩ̨̗̝͓̥̳̣̈̽ͧ͋͑ͯ̚͞r̮̖̟̆ͩḑ͍͉͚̪̭͈̮ͮͬͣͭ̽̐̄̓̑͜i̶̪͎̹̰̭͎͋͗ͧ͌͛͜͢a͉̦͇̖͓̰ͣͭ̾͗n̮̞̣̝̤̤͔̊͜ ̧̗͐̊͢h̴͙̳͉̺͕͌̉ͫ͐͒̋͊i̢̳͓̤̖͎̼ͤ̓ͫ̐ͬ̆͌̕͢ṽ͎͉̳̭̭̠̠̬̠͐͊̾͊ȩ̣̺̖̒̏̌͠-Mind of ̑͘҉̯̤̘͕̺͡c̢̭̭̜̙̥͊̓ͤ̍ͨẖ̫̖̆ͪ̌ͭ͞ä̷̫̺̩̘̪͍ͤͫͫ̒ͦ͆͠͡o̥̖̥͚̾̋͋͊ͨ̆s̘͉͔̫̪͕̠̟ͯ̒͋ͦ̒͢.̣̦̦̞ͮͬͩ ̰̦̤̞̹̮̟ͩ̓̓̉͒̏ͫ͢Z̉͘͏̗̮a̧͌͋͛̏͏͏̣̩͍̞l̛̟̥͎ͨ͒̐ͤ͛g̰̣ͫͣ̋͊ô̷̶͕̩͎̳̻̣̯̘̋̊̅ͧ̏ͫ.̴̮̯̺̻̻̣̿ͯ͒ ̣̗ B. ̴͙̼̭̺̙͚̳̪ͨ̈Z̵̶̘̗̩̜̍ͭ̿͒̊ͫA̴̸ͧ̊̚҉̺͖̠͖̜̠̩͇L̶̠̾͗ͦ͐͌ͯͤ̇G̫̞͔̭̻̖̥̜̗͊ͪͦͧ̔ͩ͘͜Õ̷͉͈̖̭̰̪̾ͭͯ͆̚! ̴͙̼̭̺̙͚̳̪ͨ̈ B. ̣̠̥̥̝͓ͯ̒̽̽̒͌̉ͣ͞

    
asked by anonymous 22.05.2015 / 14:54

1 answer

1

You can try to use this snippet of code in your PHP script.

if ( preg_match ( '/[^\x20-\x7E]/', $text ) || preg_match ( '/[^\x20-\x7E]/', $text ) ) {
    die('ZALGO not allowed');
}

How to prevent Zalgo Text

As I researched, iso may not solve the problem and end up removing valid words, but I think it worth the attempt: -).

    
22.05.2015 / 20:55