Re: WebOb question

1 view
Skip to first unread message

Ian Bicking

unread,
Sep 16, 2009, 2:24:13 PM9/16/09
to Pavel Skvazh, Paste Users
I'm not really sure what kind of data is coming in?  Is this something like a unicode filename in an upload?

On Wed, Sep 16, 2009 at 4:46 AM, Pavel Skvazh <pavel....@gmail.com> wrote:
Hi, Ian.

I'm getting an error
Module webob.multidict:314 in __getitem__ view
Module webob.multidict:299 in _decode_value view
Module encodings.utf_8:16 in decode view
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-5: ordinal not in range(128)
with the `value` being u'\u0433\u043d\u0438\u043b\u0430\u044f.jpg'

In this file webob\multidict.py
I've noticed 
    def _encode_value(self, value):
        # FIXME: should this do the FieldStorage stuff too?
        if isinstance(value, unicode):
            value = value.encode(self.encoding, self.errors)
        return value

What are the concerns behind this lines of code?

That clearly doesn't encode FieldStorage values and that's clear that it'll fail during decoding.

-- 
Best regards,
Pavel Skvazh



--
Ian Bicking  |  http://blog.ianbicking.org  |  http://topplabs.org/civichacker
Reply all
Reply to author
Forward
0 new messages