Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: CGI and Unicode

Reply
Thread Tools

Re: CGI and Unicode

 
 
Andrew Clover
Guest
Posts: n/a
 
      06-23-2003
http://www.velocityreviews.com/forums/(E-Mail Removed) (Jim Hefferon) wrote:

> the best that I can hope for is to set the page with the form on it
> to be showing, say UTF-8, and then the data should show up UTF-8
> encoded at my site.


Yes. Theoretically you should also be able to use the accept-charset
attribute on <form>, but many common browsers ignore that.

> But when I ask what is the type of the variable that I get from
> the cgi module, it comes out as StringType, not UnicodeType.


Yes, you have to decode all submitted strings manually when using the
cgi module.

You don't actually lose anything this way, because although browsers
are *supposed to* submit charset information when they send a multipart/
form-data request, they actually don't, so you have to guess from the
encoding you originally sent them.

Plug: you might want to look at:

http://www.doxdesk.com/software/py/form.html

This is a replacement for the 'cgi' module which tries to make things
generally less hassle; it will optionally give you Unicode input
automatically, for one.

--
Andrew Clover
(E-Mail Removed)
http://www.doxdesk.com/
 
Reply With Quote
 
 
 
 
Tyler Eaves
Guest
Posts: n/a
 
      06-24-2003
On Mon, 23 Jun 2003 15:49:42 -0700, Andrew Clover wrote:


> Plug: you might want to look at:
>
> http://www.doxdesk.com/software/py/form.html


Oh, wow!

Wish I'd known about *that* years ago.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Python unicode utf-8 characters and MySQL unicode utf-8 characters Grzegorz Śliwiński Python 2 01-19-2011 07:31 AM
Help for Unicode char and Unicode char based string in Ruby Chirag Mistry Ruby 6 02-08-2008 12:45 PM
cgi and cgi-bin zippy Perl Misc 5 02-02-2005 01:46 AM
Re: CGI and Unicode Jeremy Yallop Python 0 06-23-2003 09:46 PM
Re: CGI and Unicode Gilles Lenfant Python 0 06-23-2003 08:37 PM



Advertisments