Skip to content

Instantly share code, notes, and snippets.

@ryonsherman
Last active August 29, 2015 14:16
Show Gist options
  • Save ryonsherman/2bb6b2de1ac3e4a75cde to your computer and use it in GitHub Desktop.
Save ryonsherman/2bb6b2de1ac3e4a75cde to your computer and use it in GitHub Desktop.
Output text containing random Combining Diacritical Marks
#!/usr/bin/env python2
import sys
import random
text = ' '.join(sys.argv[1:])
if not text:
sys.exit("usage: %s <text>" % sys.argv[0])
output = []
for char in text:
char = unicode(char)
if char.isspace():
output.append(char)
continue
for i in range(random.randint(2, 5)):
mark = random.randint(int('0300', 16), int('036F', 16))
char += unichr(mark + 1)
output.append(char)
print ''.join(output)
@ryonsherman
Copy link
Author

Unicode Specificion

Example:

./unicombine.py Hello World

H͏̣̣e̱̲̓ͤ͌ḻ͖̐͝l̻̺͈̿oͣ͂̿̀ W͖̒ͪ̚o̡ͦr̜̜ͩ̔lͥͣ́̎̕d̾ͪ̓͗ͣ

./unicombine.py The quick brown fox jumps over the lazy dog

T̨̓̈́̕h͕ͧé͈ͥ q̸̷̤ͭu͑̈́i̒ͧc̞̝kͩ͐̎ b̷̧̤͘rͦ̀͂õ͈̃̊ͅẃ̅n̼̰͟ f̻ͧo͏̩x͓̲̜ ĵ̄u̮͊̄ͦ͞m̳͍̔͌p̶̻ͯs̴̰ͫ̓͠ o̮͏̤͈̖v̰̰ͯę̡̻͛͡r̷͎ͫ͢͞ ẗ́͞h̆ͫ̽e͓̐̀͛̊ l͉͔a̘̅͗̋̈́z̦͆̈͟y̜̠͇͆ͮ d̶̨̨͠o̷̼gͰ̏ͬ̑

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment