title: Python 2: ASCII issue when writing in Excel files
body: <p>Problem sketch:</p>
  
  <pre><code>UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 0: ordinal not in range(128)
  </code></pre>
  
  <p>I'm trying to write a simple python program that can auto-complete the blank units with data appeared in the same column above.</p>
  
  <p>Since there're Chinese characters in the file, I've thought of the issue of ASCII, so I tried to change it into UTF-8.</p>
  
  <p>Codes shown below:</p>
  
  <pre><code>#!/usr/bin/python
  # -*- coding:utf-8 -*-
  from xlrd import open_workbook
  from xlwt import Workbook
  from xlutils.copy import copy
  
  rb = open_workbook('data.xls', 'utf-8')
  wb = copy(rb)
  
  sh = wb.get_sheet(0)
  s = rb.sheet_by_index(0)
  cols = s.ncols
  rows = s.nrows
  
  temp = 0
  for cx in range(cols):
      for rx in range(rows):
          if s.cell_value(rowx = rx, colx = cx).encode('utf-8') != "":
              temp = s.cell_value(rowx = rx, colx = cx).encode('utf-8')
              print(temp) #to verify
          else:
              sh.write(rx, cx, temp)
  
  wb.save('data.xls')
  </code></pre>
  
  <p>However, the issue still happened. Result in terminal:</p>
  
  <pre><code>ZishengdeMacBook-Pro:Downloads zisheng$ python form.py
  (printed result ignored, and it looked good)
  Traceback (most recent call last):
    File "form.py", line 41, in &lt;module&gt;
      wb.save('data.xls')
    File "/Users/zisheng/anaconda/lib/python2.7/site-packages/xlwt/Workbook.py", line 710, in save
      doc.save(filename_or_stream, self.get_biff_data())
    File "/Users/zisheng/anaconda/lib/python2.7/site-packages/xlwt/Workbook.py", line 674, in get_biff_data
      shared_str_table   = self.__sst_rec()
    File "/Users/zisheng/anaconda/lib/python2.7/site-packages/xlwt/Workbook.py", line 636, in __sst_rec
      return self.__sst.get_biff_record()
    File "/Users/zisheng/anaconda/lib/python2.7/site-packages/xlwt/BIFFRecords.py", line 77, in get_biff_record
      self._add_to_sst(s)
    File "/Users/zisheng/anaconda/lib/python2.7/site-packages/xlwt/BIFFRecords.py", line 92, in _add_to_sst
      u_str = upack2(s, self.encoding)
    File "/Users/zisheng/anaconda/lib/python2.7/site-packages/xlwt/UnicodeUtils.py", line 50, in upack2
      us = unicode(s, encoding)
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 0: ordinal not in range(128)
  </code></pre>
  
  <p>Anyone can help? Thanks in advance!</p>
  
  <p><strong>I've figured it out!</strong></p>
  
  <p>To solve this, we can add UTF-8 notation in the writing process:</p>
  
  <pre><code>sh.write(rx, cx, unicode(temp, 'utf-8'))
  </code></pre>
  
  <p>And it's done.</p>