[Zope3-dev] Re: Make AbsoluteURL produce quoted urls
Philipp von Weitershausen
philipp at weitershausen.de
Tue Jun 1 08:39:24 EDT 2004
Bjorn Tillenius wrote:
> > No, I think there's a quite easy solution. AbsoluteURL.__call__ should
> > return unicode so that one has all the options when using it from
> > Python. AbsoluteURL.__str__ should return whatever __call__ would
> > return, but encoded in UTF8. If I remember correctly, TALES first
> > evaluates __str__ before __call__, so the path expressions would still
> > be fine.
>
> I'm almost fine with this, __str__ should still return ascii, it should
> quote the url instead (but maybe that's what you meant).
Indeed the spec (http://www.ietf.org/rfc/rfc2718.txt, section 2.2.5)
suggests::
Unless there is some compelling reason for a
particular scheme to do otherwise, translating character sequences
into UTF-8 (RFC 2279) [3] and then subsequently using the %HH
encoding for unsafe octets is recommended.
So, __str__ could indeed first encode to UTF-8 and then urlquote so we
end up with%HH. I can't come up with a good use case for wanting a
string but not quoted, so having either unicode or a quoted string would
be enough and easily implemented.
Philipp
More information about the Zope3-dev
mailing list