Yes, agreed. However, my question is more about what web2py is doing under the hood. If I do a file upload, is web2py doing any kind of encoding detection on the file contents and then converting to utf8? How about text upload? Furthermore, when I write a file using db....store, does web2py do a utf8 encoding?
On Sep 4, 11:06 pm, "Ray (a.k.a. Iceberg)" <[email protected]> wrote: > 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?

