python cgi problem with textarea

placid Bulkan at gmail.com
Tue Apr 24 07:00:25 EDT 2007


On Apr 24, 4:52 pm, Tim Roberts <t... at probo.com> wrote:
> placid <Bul... at gmail.com> wrote:
> >On Apr 23, 1:01 am, Adrian Smith <adrian_p_sm... at yahoo.com> wrote:
> >> On Apr 22, 10:09 pm, placid <Bul... at gmail.com> wrote:
>
> >> > i just tried it and its working. here it is
>
> >> >http://yallara.cs.rmit.edu.au/~bevcimen/form.html
>
> >> > maybe the internal server error is because mod_python isn't installed
> >> > assuming your using Apache as your web server
>
> >> Yeah, but it wouldn't work *at all* in that case, would it? ATM it
> >> seems to work as long as the textarea input has no spaces.
>
> >it doest work because the "space" character isnt interpreted
> >correctly, you need to change the space characters too  
>
> What???  Did you even read the problem description?

oops...i did read the problem description, but i when i tried the code
it worked for me and when i put spaces into the TextArea it wasn't
reflected correctly back. So i thought this was the problem.

Adrian, can you still try replacing spaces with   via the
following;

#!/usr/bin/python
import cgi
import urllib
import cgitb
cgitb.enable()
print "Content-type: text/html\n"
form = cgi.FieldStorage()
#print urllib.quote_plus(form["essay"].value)

for char in form["essay"].value:
   if char == ' ':
      print " "
   else:
      print char


Cheers




More information about the Python-list mailing list