python appengine form-posted utf8 file issue

Posted by khany on Stack Overflow See other posts from Stack Overflow or by khany
Published on 2010-01-02T14:01:11Z Indexed on 2010/03/20 3:01 UTC
Read the original article Hit count: 329

Filed under:
|
|
|

hi,

i am trying to form-post a sql file that consists on many INSERTS, eg.

INSERT INTO `TABLE` VALUES ('abcdé', 2759);

then i use re.search to parse it and extract the fields to put into my own datastore. The problem is that, although the file contains accented characters (see the e is a é), once uploaded it loses it and either errors or stores a bytestring representation of it.

Heres what i am currently using (and I have tried loads of alternatives):

form = cgi.FieldStorage()
uFile = form['sql']
uSql = uFile.file.read()
lineX = uSql.split("\n") # to get each line

and so on.

has anyone got a robust way of making this work? remember i am on appengine so access to some libraries is restricted/forbidden

© Stack Overflow or respective owner

Related posts about python

Related posts about form