@@ -86,11 +86,14 @@ produced by :mod:`cgitb` provide information that can save you a lot of time in
8686tracking down bugs. You can always remove the ``cgitb `` line later when you
8787have tested your script and are confident that it works correctly.
8888
89- To get at submitted form data, use the :class: `FieldStorage ` class. Instantiate
90- it exactly once, without arguments. This reads the form contents from standard
91- input or the environment (depending on the value of various environment
92- variables set according to the CGI standard). Since it may consume standard
93- input, it should be instantiated only once.
89+ To get at submitted form data, use the :class: `FieldStorage ` class. If the form
90+ contains non-ASCII characters, use the *encoding * keyword parameter set to the
91+ value of the encoding defined for the document. It is usually contained in the
92+ META tag in the HEAD section of the HTML document or by the
93+ :mailheader: `Content-Type ` header). This reads the form contents from the
94+ standard input or the environment (depending on the value of various
95+ environment variables set according to the CGI standard). Since it may consume
96+ standard input, it should be instantiated only once.
9497
9598The :class: `FieldStorage ` instance can be indexed like a Python dictionary.
9699It allows membership testing with the :keyword: `in ` operator, and also supports
@@ -136,10 +139,10 @@ commas::
136139
137140If a field represents an uploaded file, accessing the value via the
138141:attr: `value ` attribute or the :func: `getvalue ` method reads the entire file in
139- memory as a string . This may not be what you want. You can test for an uploaded
142+ memory as bytes . This may not be what you want. You can test for an uploaded
140143file by testing either the :attr: `filename ` attribute or the :attr: `!file `
141144attribute. You can then read the data at leisure from the :attr: `!file `
142- attribute::
145+ attribute (the :func: ` read ` and :func: ` readline ` methods will return bytes) ::
143146
144147 fileitem = form["userfile"]
145148 if fileitem.file:
0 commit comments