title: UnicodeDecodeError while using json.dumps()
body: <p>I have strings as follows in my python list (taken from command prompt):</p>
  
  <pre><code>&gt;&gt;&gt; o['records'][5790]
  (5790, 'Vlv-Gate-Assy-Mdl-\xe1M1-2-\xe19/16-10K-BB Credit Memo            ', 60,
   True, '40141613')
  &gt;&gt;&gt;
  </code></pre>
  
  <p>I have tried suggestions as mentioned here: <a href="https://stackoverflow.com/questions/2276200/changing-default-encoding-of-python#comment2239381_2276222">Changing default encoding of Python?</a></p>
  
  <p>Further changed the default encoding to utf-16 too. But still <code>json.dumps()</code> threw and exception as follows:</p>
  
  <pre><code>&gt;&gt;&gt; write(o)
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "okapi_create_master.py", line 49, in write
      o = json.dumps(output)
    File "C:\Python27\lib\json\__init__.py", line 231, in dumps
      return _default_encoder.encode(obj)
    File "C:\Python27\lib\json\encoder.py", line 201, in encode
      chunks = self.iterencode(o, _one_shot=True)
    File "C:\Python27\lib\json\encoder.py", line 264, in iterencode
      return _iterencode(o, 0)
  UnicodeDecodeError: 'utf8' codec can't decode byte 0xe1 in position 25: invalid
  continuation byte
  </code></pre>
  
  <p>Can't figure what kind of transformation is required for such strings so that <code>json.dumps()</code> works.</p>