unicode error when importing csv file
Question: i am using google app engine to import a csv file and insert it into a
database but its giving me this error:

    
    
    UnicodeEncodeError: 'ascii' codec can't encode character u'\xf0' in position 3: ordinal not in range(128)
    

the file i'm importing is utf-8 the python code is utf-8

heres the form:

    
    
        site = "order"
    
        scripts = ""
    
        content = """
            <div class="row" style="margin-top: 10px;">
                <div class="large-12 columns">
                    <form enctype="multipart/form-data" method="post" action="import">
                        <select name="db">
                            <option value="users">Users</option>
                            <option value="machines">Machines</option>
                            <option value="company">Company</option>
    
                            <option value="process">Order</option>
                            <option value="status">Status</option>
                            <option value="part">Part</option>
    
                            <option value="machineType">Machine Type</option>
                        <select>
                        <input name="file" type="file">
                        <input type="submit" value="submit" class="button">
                    </form>
                </div>
            </div>
        """
    
        template_values = {
            'site': site,
            'scripts': scripts,
            'content': content,
        }
    
    
        template = JINJA_ENVIRONMENT.get_template('main.html')
        self.response.write(template.render(template_values))
    

And here is the post class:

    
    
    reader = csv.reader(StringIO.StringIO(self.request.get('file').decode('utf-8'))),
    
    database = self.request.get('db')
    
    for row in reader:
                for item in row:
                    tiles = item[0].replace('&comma', ',').split(';')
    
                    x = machineType(
                      Description = tiles[0],
                      ID = tiles[1],
                      Brand = tiles[2],
                      Type = tiles[3])
                    x.put()
    
                    self.response.write("Row imported [" + tiles[0] + ", "  + tiles[1] + ", "  + tiles[2] + ", "  + tiles[3] + "]</br>" )
    


Answer: This should work - `self.request.get('file').decode('utf-8').encode('ascii',
'ignore')`

