title: Generate random UTF-8 string in Python
body: <p>I'd like to test the Unicode handling of my code. Is there anything I can put in random.choice() to select from the entire Unicode range, preferably not an external module? Neither Google nor StackOverflow seems to have an answer.</p>
  
  <p>Edit: It looks like this is more complex than expected, so I'll rephrase the question - Is the following code sufficient to generate all valid <a href="http://www.unicode.org/Public/UNIDATA/UCD.html#General_Category_Values" rel="noreferrer">non-control characters in Unicode</a>?</p>
  
  <pre><code>unicode_glyphs = ''.join(
      unichr(char)
      for char in xrange(1114112) # 0x10ffff + 1
      if unicodedata.category(unichr(char))[0] in ('LMNPSZ')
      )
  </code></pre>