title: Python: Can dumpdata cannot loaddata back. UnicodeDecodeError
body: <p>I have been using Python 2.7, Django 1.5 and PostgreSQL 9.2 for two weeks. Never saw it before. Everything is freshly installed on my Windows 7 machine, so it should have default settings. Django beautifully generates tables in my db. Looks like everything works fine.
  I am able to  dump data from my database by running:</p>
  
  <pre><code>manage.py dumpdata &gt; test.json
  </code></pre>
  
  <p>or</p>
  
  <pre><code>manage.py dumpdata  --indent4 &gt; test.json
  </code></pre>
  
  <p>I saw that the JSON file it looks  as it should.</p>
  
  <p>Then, I truncate some tables and try to load them from the JSON file with:</p>
  
  <pre><code>python manage.py loaddata database = T2  test.json    // or without db name
  </code></pre>
  
  <p>I got the following error:</p>
  
  <blockquote>
    <p>“UnicodeDecodeError: 'utf8' codec can't decode byte 0xff in position
    0: invalid start byte”</p>
  </blockquote>
  
  <p>If I open the test.json file in notepad, save it as <code>utf8</code> and try again, then I get:</p>
  
  <blockquote>
    <p>“No JSON object could be decoded”</p>
  </blockquote>
  
  <p>The file still looks OK, not empty.</p>
  
  <p>By the way, when I open the JSON file with notepad it offers me to save it as Unicode. My database has UTF8 encoding. Please advise. Thank you.</p>