I'm embarrassed to say that I'm *still* having trouble getting unicode working on uploaded files. I'm sure this is an incredibly stupid easy thing to do, but unicode has never come easy for me.
# model db.define_table('infile', Field('name', 'upload',uploadseparate=True)) # controller for uploading using a component def from_file(): form = SQLFORM(db.infile) if form.process().accepted: # store uploaded file request.vars.name.file.seek(0) # rewind uploaded file infile_id = db.infile.insert( name=db.infile.name.store( request.vars.name.file, request.vars.name.filename ) ) response.flash = ... response.js = ... elif file_form.errors: ... return dict(form=form) I'm trying to figure out how to encode the uploaded file before inserting it into the db manually. I've tried lots of things to encode before inserting. The latest failed attempt is this: text = reqeust.vars.name.file.getvalue() from gluon import decoder text = decoder.decoder(text) and then inserted text rather than request.vars.name.file, but this doesn't work. decoder throws a ticket saying File "N:\web2py\gluon\decoder.py", line 74, in decoder return buffer.decode(encoding).encode('utf8') File "c:\Program Files (x86)\Python25\lib\encodings\utf_8.py", line 16, in decode return codecs.utf_8_decode(input, errors, True) UnicodeDecodeError: 'utf8' codec can't decode bytes in position 4-7: invalid data I'm really just grasping at straws right now. Any helpful examples would be appreciated.