#28123: django.utils.html.smart_urlquote() is incorrectly parsing the query
string
--------------------------------+--------------------------------------
Reporter: Denis Pechenev | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 1.10
Severity: Normal | Resolution:
Keywords: smart_urlquote | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+--------------------------------------
Comment (by Igor Gumenyuk):
The is very annoying bug in `smart_urlquote` since `urlize` (for example)
calls it internally and passes unicode as an argument.
And there is no way to wrap argument in `str()` (sic!) or at least
`.encode('ascii')` without forking `urlize`
Here's an example to show the issue:
{{{
from django.utils.html import smart_urlquote, urlize
s1 =
'http://example.com/?search_text=%D0%BF%D1%80%D0%B8%D0%B2%D0%B5%D1%82'
#'http://example.com/?search_text=привет
s2 =
u'http://example.com/?search_text=%D0%BF%D1%80%D0%B8%D0%B2%D0%B5%D1%82'
In [15]: smart_urlquote(s1)
Out[15]:
u'http://example.com/?search_text=%D0%BF%D1%80%D0%B8%D0%B2%D0%B5%D1%82'
In [16]: smart_urlquote(s2)
Out[16]:
u'http://example.com/women?search_text=%C3%90%C2%BF%C3%91%C2%80%C3%90%C2%B8%C3%90%C2%B2%C3%90%C2%B5%C3%91%C2%82'
}}}
With unicode string resulting URL gets double urlquoted.
--
Ticket URL: <https://code.djangoproject.com/ticket/28123#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/067.43360641d1ea2934d61922e8532ef5c3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.