title: How do I properly set TeraData pyodbc charset/encoding?
body: <p>I have a problem using pyodbc with a TeraData server -- My perl connection which uses the same ODBC drivers work without issue. </p>
  
  <p>It appears pyodbc is connecting because I can fetch table names, however, the table names are not encoded properly (example below). Here is a list of things I've tried:</p>
  
  <ol>
  <li>Setting CHARSET/ENCODING in my DSN as 'ASCII', 'UTF-8', and many others</li>
  <li><p>Setting the locale:</p>
  
  <p>locale.setlocale(locale.LC_ALL, 'en_US.utf8')</p></li>
  <li><p>Changing autocommit and ANSI=True/False' in pyodbc.connect()</p></li>
  </ol>
  
  <p>python==3.4.3, pyodbc==3.0.10</p>
  
  <p><strong>.odbc.ini:</strong></p>
  
  <pre><code>[ODBC]
  InstallDir=/opt/teradata/client/15.10/odbc_64
  Trace=0
  TraceDll=/opt/teradata/client/15.10/lib/odbctrac.so
  TraceFile=/home/solberg/teratrace
  TraceAutoStop=0
  
  [ODBC Data Sources]
  tera01=Teradata ODBC Driver 15.10
  
  [tera01]
  Driver=/opt/teradata/client/15.10/lib64/tdata.so
  DBCName=tera01
  Username=solberg
  Authentication=LDAP
  </code></pre>
  
  <p><strong>.odbcinst.ini:</strong></p>
  
  <pre><code>[ODBC DRIVERS]
  Teradata=Installed
  
  [ODBC Translators]
  OEB to ANSI=Installed
  </code></pre>
  
  <p><strong>python code:</strong></p>
  
  <pre><code>import pyodbc
  pyodbc.pooling = False
  conn = pyodbc.connect('DSN=tera01;', password=pw)
  
  cursor = conn.cursor()
  cursor.tables()
  rows = cursor.fetchall()
  
  print(row[0].table_name)
  </code></pre>
  
  <p>扁牯䱴獩却獥楳湯</p>
  
  <pre><code>print(row[0].table_name.encode('utf_16_le'))
  </code></pre>
  
  <p>b'AbortListSession'</p>
  
  <pre><code>conn.execute("SELECT DISTINCT column FROM table;").fetchall()
  </code></pre>
  
  <p>Error: ('HY000', '[HY000] [unixODBC][Driver Manager]Driver returned SQL_ERROR or SQL_SUCCESS_WITH_INFO but no error reporting API found (0) (SQLExecDirectW)')</p>