Re: redirect burps on unicode URLs
Andreas Jung <[email protected]>
| Newsgroups | gmane.comp.web.zope.devel |
|---|---|
| Organization | ZOPYX Ltd & Co. KG |
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Adam GROSZER wrote:
> Hello,
>
> Looks like zope.publisher burps on unicode URL which contain
> non-ascii chars. This is from a KGS 3.4 application, but looking
> at the source it still seems to have the same problems.
>
> opinions?
>
> ... self.request.response.redirect(url) File
> "d:\home\.buildout\eggs\zope.publisher-3.4.6-py2.5.egg\zope\publisher\browser.py",
>
>
line 729, in redirect return super(BrowserResponse,
> self).redirect(location, status) File
> "d:\home\.buildout\eggs\zope.publisher-3.4.6-py2.5.egg\zope\publisher\http.py",
>
>
line 882, in redirect self.setHeader('Location', location) File
> "d:\home\.buildout\eggs\zope.publisher-3.4.6-py2.5.egg\zope\publisher\http.py",
>
>
line 676, in setHeader value = str(value) UnicodeEncodeError:
> 'ascii' codec can't encode character u'\xd6' in position 71:
> ordinal not in range(128)
As Tres pointed out: URLs must be properly encoded and it is not safe
to pass python unicode
strings to APIs expecting byte strings.
Andreas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkuGoSoACgkQCJIWIbr9KYxyfQCfeHfH08kUzbwakG6PYXWVuptA
TCgAn2BQjVIUc+/2IxiYhBdaRHaigT/+
=SzNi
-----END PGP SIGNATURE-----
_______________________________________________
Zope-Dev maillist - [email protected]
https://mail.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists -
https://mail.zope.org/mailman/listinfo/zope-announce
https://mail.zope.org/mailman/listinfo/zope )
lists.vcf
(text/x-vcard, 316 B)
begin:vcard fn:Andreas Jung n:Jung;Andreas org:ZOPYX Ltd. & Co. KG adr;quoted-printable:;;Charlottenstr. 37/1;T=C3=BCbingen;;72070;Germany email;internet:[email protected] title:CEO tel;work:+49-7071-793376 tel;fax:+49-7071-7936840 tel;home:+49-7071-793257 x-mozilla-html:FALSE url:www.zopyx.com version:2.1 end:vcard