title: Ye olde UnicodeEncodeError printing results from a query on MS SQL with adodbapi
body: <p>Python novice here.</p>
  
  <p>I am using python2.7.2 on Windows7.</p>
  
  <p>I have installed the PyWin32 extensions (build 217).</p>
  
  <p>I have adopdbapi installed in <code>c:\Python27\Lib\site-packages\adodbapi</code></p>
  
  <p>I have a very simple module that queries the AdventureWorks2008LT database in MS SQL Server.  </p>
  
  <pre><code>import adodbapi
  
  connStr='Provider=SQLOLEDB.1;' \
      'Integrated Security=SSPI;' \
      'Persist Security Info=False;' \
      'Initial Catalog=AVWKS2008LT;' \
      'Data Source=.\\SQLEXPRESS'
  
  conn = adodbapi.connect(connStr)
  
  tablename = "[salesLT].[Customer]"
  
  # create a cursor
  cur = conn.cursor()
  
  # extract all the data
  sql = "select * from %s" % tablename
  cur.execute(sql)
  
  # show the result
  result = cur.fetchall()
  for item in result:
      print item
  
  # close the cursor and connection
  cur.close()
  conn.close()
  </code></pre>
  
  <p>The AdventureWorks2008LT sample database has customer, product, address, and order tables (etc). Some of the string data in these tables is unicode.</p>
  
  <p>The query works, <em>for the first couple rows</em>. I see the expected output. But then, the script fails with this message: </p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\dev\python\query-1.py", line 24, in &lt;module&gt;
      print item
    File "C:\Python27\lib\site-packages\adodbapi\adodbapi.py", line 651, in __str__
      return str(tuple([str(self._getValue(i)) for i in range(len(self.rows.converters))]))
  UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 19: ordinal not in range(128)
  </code></pre>
  
  <p>...which is very much not helpful. To me. </p>
  
  <p>I gather that adodbapi is trying to encode a u'\xe9' character into ASCII.  I understand why that will fail. 
  I suppose it's trying to do that as part of the <code>print</code> statement.</p>
  
  <p>Why is it trying to encode the character into ASCII?<br>
  How can I tell it to just use UTF-8?   </p>
  
  <p>ps: I am running the script from the cmd.exe prompt in Windows. Does this mean stdout is always ASCII?</p>
  
  <p>eg, <code>\python27\python.exe -c "import sys; print(sys.stdout.encoding)"</code></p>
  
  <p>gives me 'cp437'</p>