Index: tests/regressiontests/templates/tests.py
===================================================================
--- tests/regressiontests/templates/tests.py	(revision 12494)
+++ tests/regressiontests/templates/tests.py	(working copy)
@@ -1031,11 +1031,20 @@
             'url08': (u'{% url метка_оператора v %}', {'v': 'Ω'}, '/url_tag/%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4/%CE%A9/'),
             'url09': (u'{% url метка_оператора_2 tag=v %}', {'v': 'Ω'}, '/url_tag/%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4/%CE%A9/'),
             'url10': ('{% url regressiontests.templates.views.client_action id=client.id,action="two words" %}', {'client': {'id': 1}}, '/url_tag/client/1/two%20words/'),
+            'url11': ('{% url regressiontests.templates.views.client_action id=client.id,action="==" %}', {'client': {'id': 1}}, '/url_tag/client/1/==/'),
+            'url12': ('{% url regressiontests.templates.views.client_action id=client.id,action="," %}', {'client': {'id': 1}}, '/url_tag/client/1/,/'),
+            'url12': ('{% url regressiontests.templates.views.client_action id=client.id,action=arg|join:"-" %}', {'client': {'id': 1}, 'arg':['a','b']}, '/url_tag/client/1/a-b/'),
 
             # Failures
             'url-fail01': ('{% url %}', {}, template.TemplateSyntaxError),
             'url-fail02': ('{% url no_such_view %}', {}, urlresolvers.NoReverseMatch),
             'url-fail03': ('{% url regressiontests.templates.views.client %}', {}, urlresolvers.NoReverseMatch),
+            'url-fail04': ('{% url view id, %}', {}, template.TemplateSyntaxError),
+            'url-fail05': ('{% url view id= %}', {}, template.TemplateSyntaxError),
+            'url-fail06': ('{% url view a.id=id %}', {}, template.TemplateSyntaxError),
+            'url-fail07': ('{% url view a.id!id %}', {}, template.TemplateSyntaxError),
+            'url-fail08': ('{% url view id="unterminatedstring %}', {}, template.TemplateSyntaxError),
+            'url-fail09': ('{% url view id=", %}', {}, template.TemplateSyntaxError),
 
             # {% url ... as var %}
             'url-asvar01': ('{% url regressiontests.templates.views.index as url %}', {}, ''),
Index: django/template/defaulttags.py
===================================================================
--- django/template/defaulttags.py	(revision 12494)
+++ django/template/defaulttags.py	(working copy)
@@ -1071,6 +1071,18 @@
     return TemplateTagNode(tag)
 templatetag = register.tag(templatetag)
 
+# Regex for URL arguments including filters
+value = '''(?:(?:'[^']*')|(?:"[^"]*")|(?:[\w\.-]+))'''
+value = r"(%(value)s(?:\|%(name)s(?::%(value)s)?)*)" % {'name':'(?:\w+)', 'value':value}
+url_arg_re = re.compile('''
+        %(name)s=%(value)s
+        |
+        %(value)s
+    ''' % {
+            'name': '(\w+)',
+            'value': value
+        }, re.VERBOSE)
+
 def url(parser, token):
     """
     Returns an absolute URL matching given view with its parameters.
@@ -1118,13 +1130,19 @@
                 asvar = bits.next()
                 break
             else:
-                for arg in bit.split(","):
-                    if '=' in arg:
-                        k, v = arg.split('=', 1)
-                        k = k.strip()
-                        kwargs[k] = parser.compile_filter(v)
-                    elif arg:
-                        args.append(parser.compile_filter(arg))
+                for i, match in enumerate(url_arg_re.finditer(bit)):
+                    if (i == 0 and match.start() != 0) or \
+                          (i > 0 and (bit[end:match.start()] != ',')):
+                        raise TemplateSyntaxError("Malformed arguments to url tag")
+                    end = match.end()
+                    name, value = match.group(1), match.group(2) or match.group(3)
+                    if name:
+                        kwargs[name] = parser.compile_filter(value)
+                    else:
+                        args.append(parser.compile_filter(value))
+                if end != len(bit):
+                    raise TemplateSyntaxError("Malformed arguments to url tag")
+
     return URLNode(viewname, args, kwargs, asvar)
 url = register.tag(url)
 
