title: Russian symbols in re (Python)
body: <p>I get a data from a file:</p>
  
  <pre><code>words = re.findall(r'[\w]+',self._from.encode('utf8'),re.U)
  </code></pre>
  
  <p>If the file contains:</p>
  
  <blockquote>
    <p><em>Hi, how are you?</em></p>
  </blockquote>
  
  <p>Then result will be:</p>
  
  <blockquote>
    <p>['Hi', 'how', 'are', 'you']</p>
  </blockquote>
  
  <p>But if the file contains russian language (i.e. cyrillic symbols), then:</p>
  
  <blockquote>
    <p><em>Привет, как дела?</em></p>
  </blockquote>
  
  <p>In this case the result is:</p>
  
  <blockquote>
    <p>['\xd0', '\xd1', '\xd0', '\xd0\xb2\xd0\xb5\xd1', '\xd0\xba\xd0',
    '\xd0\xba', '\xd0', '\xd0\xb5\xd0', '\xd0']</p>
  </blockquote>
  
  <p>why? wtf?
  I've already added:</p>
  
  <pre><code>sys.setdefaultencoding('utf-8')
  </code></pre>
  
  <p>I'm using python2.7 and linux ubuntu.</p>
  
  <h2><strong>Answer:</strong></h2>
  
  <pre><code>words = re.findall(r'[\w]+',self._from.decode('utf8'),re.U)
  print u" ".join(words)
  </code></pre>