diff --git a/django/forms/util.py b/django/forms/util.py
index 1a1d8234957..85baffa0051 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 81fec1cf913..bb6ffd8095c 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)})),
+ '')