title: Encodings in ConfigParser (Python)
body: <p>Python 3.1.3
  What I need is to read dictionary from cp1251-file using ConfigParser.
  My example:</p>
  
  <pre><code>config = configparser.ConfigParser()
  config.optionxform = str
  config.read("file.cfg")
  DataStrings = config.items("DATA")
  DataBase = dict()
  for Dstr in DataStrings:
      str1 = Dstr[0]
      str2 = Dstr[1]
  DataBase[str1] = str2
  </code></pre>
  
  <p>After that I'm trying to replace some words in some UTF-8 files according dictionary. But sometimes it doesn't works (for example, with symbols of "new line-carriage return").
  My file in UTF-8 and configuration file (dictionary) in CP1251. Seems like trouble, I have to decode config into UTF-8.
  I've tryed this:</p>
  
  <pre><code>str1 = Dstr[0].encode('cp1251').decode('utf-8-sig')
  </code></pre>
  
  <p>But error <code>"'utf8' codec can't decode byte 0xcf in position 0"</code> appeared.
  If I use <code>.decode('','ignore')</code> - I just lose almost all config file.
  What should I do?</p>