Author: gwilson Date: 2010-01-03 12:07:11 -0600 (Sun, 03 Jan 2010) New Revision: 12067
Modified: django/branches/releases/1.1.X/django/utils/encoding.py Log: [1.1.X] Fixed #12445 -- Added ' (single quote), @ (at sign), and ~ (tilde) to safe characters in `iri_to_uri` function. Backport of r12066 from trunk. Modified: django/branches/releases/1.1.X/django/utils/encoding.py =================================================================== --- django/branches/releases/1.1.X/django/utils/encoding.py 2010-01-03 18:06:27 UTC (rev 12066) +++ django/branches/releases/1.1.X/django/utils/encoding.py 2010-01-03 18:07:11 UTC (rev 12067) @@ -131,12 +131,21 @@ Returns an ASCII string containing the encoded result. """ - # The list of safe characters here is constructed from the printable ASCII - # characters that are not explicitly excluded by the list at the end of - # section 3.1 of RFC 3987. + # The list of safe characters here is constructed from the "reserved" and + # "unreserved" characters specified in sections 2.2 and 2.3 of RFC 3986: + # reserved = gen-delims / sub-delims + # gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@" + # sub-delims = "!" / "$" / "&" / "'" / "(" / ")" + # / "*" / "+" / "," / ";" / "=" + # unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" + # Of the unreserved characters, urllib.quote already considers all but + # the ~ safe. + # The % character is also added to the list of safe characters here, as the + # end of section 3.1 of RFC 3987 specifically mentions that % must not be + # converted. if iri is None: return iri - return urllib.quote(smart_str(iri), safe='/#%[]=:;$&()+,!?*') + return urllib.quote(smart_str(iri), safe="/#%[]=:;$&()+,!?*@'~") # The encoding of the default system locale but falls back to the -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-upda...@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.