On 10/24/06, Jack Tihon <[EMAIL PROTECTED]> wrote:
> On 10/24/06, Shannon -jj Behrens <[EMAIL PROTECTED]> wrote:
> > On 10/24/06, Ian Bicking <[EMAIL PROTECTED]> wrote:
> > > Jack Tihon wrote:
> > > > parse_formvars() from file paste/request.py is trying to add to the
> > > > formvars MultiDict in the folowing loop:
> > > >     ...
> > > >                 formvars.add(name, value.decode('utf-8')) #the
> submitted
> > > > CGI was UTF-8
> > > >                 print "formvars.add invoked on (name, value)", name,
> value
> >
> > Woh, I'm confused now.  I'm looking at trunk
> >
> <http://trac.pythonpaste.org/pythonpaste/browser/Paste/trunk/paste/request.py
> >,
> > and I don't see that .decode code.  So Paste doesn't do any decoding
> > yet?  Decoding from UTF-8 was sufficient for my needs.
>
> Yes. Don't be confused.
>
> I was proposing that as a patch. It's not quite right since it then assumes
> UTF-8, which isn't exactly right either. It also completely blows up for
> file uploads. I decided to move that code into FormBuild instead with a
> small patch to deal with file uploads. I'll post that later tonight.
>
> On a side note, i've run into a bit of weirdness with FormBuild rendering a
> UTF-8 textfield, but I'll post to that discussion list separately.

Ah, I get it.  I have my reasons for not using FormBuild, part of
which is that Genshi allows me to do some clever things to build
forms.  Hence, I'd like to see the encoding stuff done in Paste where
we can all make use of it.  I propose:

1. Paste should decode things from UTF-8 by default.  For US-ASCII
users, this will do nothing.

2. You should be able to tell Paste via the .ini file to decode using
a different decoding or to do no decoding, in case the developer wants
to do his own thing.

3. As an optional third option, Paste can react to a form variable
named "paste_decode_encoding" (or somesuch) and decode the form
parameters using that encoding.  Yes, there are Web sites that do such
whacky things, although I doubt they use Paste ;)

This covers all the bases.

My top bug right now is to unbreak my Pylons-based application for
CJKV users, so this is something I'm keenly interested in. ;)

Best Regards,
-jj

-- 
The one who gets the last laugh isn't the one who did the laughing,
but rather the one who did the writing.

_______________________________________________
Paste-users mailing list
[email protected]
http://webwareforpython.org/cgi-bin/mailman/listinfo/paste-users

Reply via email to