Ticket #12445: 12445.diff

File 12445.diff, 1.2 KB (added by gwilson, 6 years ago)
  • django/utils/encoding.py

     
    131131
    132132    Returns an ASCII string containing the encoded result.
    133133    """
    134     # The list of safe characters here is constructed from the printable ASCII
    135     # characters that are not explicitly excluded by the list at the end of
    136     # section 3.1 of RFC 3987.
     134    # The list of safe characters here is constructed from the "reserved" and
     135    # "unreserved" characters specified in sections 2.2 and 2.3 of RFC 3986:
     136    #     reserved    = gen-delims / sub-delims
     137    #     gen-delims  = ":" / "/" / "?" / "#" / "[" / "]" / "@"
     138    #     sub-delims  = "!" / "$" / "&" / "'" / "(" / ")"
     139    #                   / "*" / "+" / "," / ";" / "="
     140    #     unreserved  = ALPHA / DIGIT / "-" / "." / "_" / "~"
     141    # Of the unreserved characters, urllib.quote already considers all but
     142    # the ~ safe.
    137143    if iri is None:
    138144        return iri
    139     return urllib.quote(smart_str(iri), safe='/#%[]=:;$&()+,!?*')
     145    return urllib.quote(smart_str(iri), safe="/#%[]=:;$&()+,!?*@'~")
    140146
    141147
    142148# The encoding of the default system locale but falls back to the
Back to Top