\r\n problem in cgi module?
Erik Max Francis
max at alcyone.com
Sat Mar 20 07:26:17 EST 2004
Jane Austine wrote:
> The HTML page includes:
>
> <textarea name="text" cols="80" rows="5"></textarea>
>
> Then I extract the "text" as such:
>
> f=cgi.FieldStorage()
> text=f['text'].value
>
> The surprise is "text" contains "\r\n" instead of "\n", when running
> on windows.
>
> Why does this happen, and what am I supposed to do? Isn't cgi module
> supposed to provide "universal_new_line"?
CGI has a weird specification where textareas are supposed to be
delimited with CR LF, regardless of the platform. Weird, I know, but
the CGI module isn't wrong here.
--
__ Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
/ \ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
\__/ Nobody can reach me, nobody can touch me; it's a wonderful
feeling. -- Aaliyah
More information about the Python-list
mailing list