\r\n problem in cgi module?

Jane Austine janeaustine50 at hotmail.com
Sat Mar 20 06:59:48 EST 2004


I'm wrote a cgi script which saves some data in a file, which is
POSTed from a HTML page.

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"?



More information about the Python-list mailing list