unicode error when posting ñ

15 views
Skip to first unread message

Patrick Aljord

unread,
Apr 22, 2008, 3:59:00 PM4/22/08
to google-a...@googlegroups.com
Hi all,

I have a basic form that post some data into the datastore.
It works great but if I enter caracters such as é è or ñ, I get this error:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 38: ordinal not in range(128)

Any idea how to fix this? like a function to convert ascii to unicode I guess?

thanks in advance

Pat

Patrick Aljord

unread,
Apr 22, 2008, 4:29:08 PM4/22/08
to google-a...@googlegroups.com
it works when using "somestring.decode('utf8')" and setting html charset to utf8

Jorge Vargas

unread,
Apr 22, 2008, 4:36:25 PM4/22/08
to google-a...@googlegroups.com
On Tue, Apr 22, 2008 at 4:29 PM, Patrick Aljord <pat...@gmail.com> wrote:
> it works when using "somestring.decode('utf8')" and setting html charset to
> utf8

yes it's basic unicode handling. by default html is ascii, there is
also a form param you should set
http://www.w3.org/TR/html401/interact/forms.html#h-17.13.3.3
and in general make your app UTF-8 compatible, that is a bit more
complicated and most frameworks handle it for you.

Reply all
Reply to author
Forward
0 new messages