I forgot to tell though it's obvious.
I only get this error when I insert in the form special characters
such as çãó


On Dec 9, 1:05 am, blackthorne <francisco....@gmail.com> wrote:
> hi
> there seems to be a bug a in the unicode process, probably in the mail
> () method on the most recent versions of web2py. I developed an
> application with a contact form that works on. When I got it into
> production, I tested it with the latest version of web2py and I got
> Internal Server Error with the message:
>
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
> 0: ordinal not in range(128)
>
> def email_user(sender,msg,about="group notice"):
>     message='Reply-to: ' + sender + '\n ' + msg
>     return mail.send(to=
> ['blacktho...@ironik.org','fernando.t.ribe...@gmail.com'],
>     subject=about,
>     message=msg)
>
> def contact():
>     response.view = theme + '/contact.html'
>     form=SQLFORM(db.mail,fields=
> ['your_name','your_email','your_message'])
>     if form.accepts(request.vars,session,dbio=False):
>         subject='casasdocastro.com: ' + form.vars.your_name
>         sent = email_user(sender=form.vars.your_email,
> -->    msg=form.vars.your_message,
>          about=subject)
>         if sent:
>             response.flash=T('message_submitted')
>         else:
>             response.flash=T('message_failed')
>         db.mail.insert(your_name=form.vars.your_name,
> your_email=form.vars.your_email, your_message=form.vars.your_message,
> sent=sent)
>     elif form.errors:
>         response.flash=T('check_contact_form')
>     form.custom.submit['_value']=T('send_submit')
>     return dict(form=form,
>                 news=getNews())
>
> Again, this code works fine in v1.67
>
> Thank, Best Regards

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.


Reply via email to