﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
22589	url reverse should encode forward slashes	Denilson Figueiredo de Sá	nobody	"I have essentially the same issue as this guy: http://stackoverflow.com/questions/4241484/use-djangos-url-template-tag-with-special-characters

{{{
# In urls.py:
url(r'^something/(?P<title>[^/]*)/something/else$', views.something, name='something'),

# In a template:
<a href=""{% url something page.title %}"">Some link</a>
}}}

Here, `page.title` is a completely free-form string that might contain any characters, including forward slashes. I want to encode it completely. The current url `reverse()` code will quote any parameters using Django's `urlquote`, which will call Python's `quote`, which will encode all special characters, except the slash (and `_.-`).

https://github.com/django/django/blob/91afc00513bd2fa6302ea2be35e1f842cbd5fd38/django/core/urlresolvers.py#L459

There is no hook or option to make url reverse encode the slash while building the URL. We can't pre-encode the slash either, as it will lead to double-encoding the slashes (requiring an extra decoding step inside the view). So, there is no straightforward way to build a URL while encoding the slashes from args.

My suggestion is to change the behavior of url reverse to also encode forward slashes. Or, at least, give some flexibility when encoding the URL."	Uncategorized	closed	Uncategorized	1.6	Normal	duplicate			Unreviewed	0	0	0	0	0	0
