Generally speaking, you can't assume a file's encoding, unless you are the creator of that file therefore knows its encoding.
Regards, Ray On Sep 5, 7:52 am, weheh <[email protected]> wrote: > I have a text string which is read from a file. The file was created > by the db...store mechanism. The original data came from either an > uploaded file or a text field. I have neither decoded nor encoded > anything. Shouldn't I assume the text in the file is utf8? (Please oh > please say yes.) > > On Sep 4, 7:30 pm, Massimo Di Pierro <[email protected]> > wrote: > > > > > > > > > web2py internally expects everything to be bytes representing utf8- > > encoded strings. > > > On Sep 4, 1:02 pm, weheh <[email protected]> wrote: > > > > When I create a form with form=SQLFORM(...), if I have a myfield of > > > type "text"is the form.vars.myfield value of type unicode? If I then > > > save the field in a file by doing a db.mytable.myfield.store(...) does > > > it automatically get encoded to utf-8?

