In Django what is the url pattern I need to use to handle urlencode characters such as %20
I am using (?P<name>[\w]+)
but this only handles alphanumeric characters so % is causing an error
I was able to make it work using the configuration given below. Check if it will suit your needs.
(?P<name>[\w|\W]+)
If you only want to allow space:
(?P<name>[\w\ ]+)
The best way to do that and allow others chars is using '\s' that is any spaces, tabs and new lines
(?P<name>[\w\s]+)
来源:https://stackoverflow.com/questions/3675368/django-url-pattern-for-20