diff --git a/django/forms/util.py b/django/forms/util.py
index 1a1d823495..85baffa005 100644
--- a/django/forms/util.py
+++ b/django/forms/util.py
@@ -27,7 +27,7 @@ class ErrorDict(dict, StrAndUnicode):
def as_ul(self):
if not self: return u''
return mark_safe(u'
'
- % ''.join([u'%s%s' % (k, force_unicode(v))
+ % ''.join([u'%s%s' % (k, conditional_escape(force_unicode(v)))
for k, v in self.items()]))
def as_text(self):
diff --git a/tests/regressiontests/forms/tests/util.py b/tests/regressiontests/forms/tests/util.py
index 81fec1cf91..bb6ffd8095 100644
--- a/tests/regressiontests/forms/tests/util.py
+++ b/tests/regressiontests/forms/tests/util.py
@@ -55,3 +55,7 @@ class FormsUtilTestCase(TestCase):
'- Example of link: <a href="http://www.example.com/">example</a>
')
self.assertEqual(str(ErrorList([mark_safe(example)])),
'')
+ self.assertEqual(str(ErrorDict({'name': example})),
+ '- nameExample of link: <a href="http://www.example.com/">example</a>
')
+ self.assertEqual(str(ErrorDict({'name': mark_safe(example)})),
+ '')