title: How to use russian date string with strptime
body: <p>I parse html with python and there is date string: <code>[ 24-Янв-17 07:24 ]</code>. "Янв" is "Jan". I want to convert it into datetime object.</p>
  
  <pre><code># Some beautifulsoup parsing
  timeData = data.find('div', {'id' : 'time'}).text
  
  import locale
  locale.setlocale(locale.LC_TIME, 'ru_RU.UTF-8')
  result = datetime.datetime.strptime(timeData, u'[ %d-%b-%y  %H:%M ]')
  </code></pre>
  
  <p>The error is: </p>
  
  <blockquote>
    <p>ValueError: time data '[ 24-\xd0\xaf\xd0\xbd\xd0\xb2-17 07:24 ]' does
    not match format '[ %d-%b-%y  %H:%M ]'</p>
  </blockquote>
  
  <p><code>type(timeData)</code> returns unicode. Encoding <code>timeData</code> from <code>utf-8</code> returns <code>UnicodeEncodeError</code>. What's wrong?</p>
  
  <hr>
  
  <p>chardet returns <code>{'confidence': 0.87625, 'encoding': 'utf-8'}</code> and when I write: <code>datetime.datetime.strptime(timeData.encode('utf-8'), ...)</code> it returns error as above.</p>
  
  <hr>
  
  <p>Original page has <code>window-1251</code> encoding.</p>
  
  <pre><code>print type(timeData)
  print timeData
  
  
  timeData = timeData.encode('cp1251')
  print type(timeData)
  print timeData
  </code></pre>
  
  <p>returns</p>
  
  <pre><code>&lt;type 'unicode'&gt;
  [ 24-Янв-17 07:24 ]
  &lt;type 'str'&gt;
  [ 24-???-17 07:24 ]
  </code></pre>