Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #10675 -- Added unicode paragraph and line-sep handling to esca…


There were a couple of line breaking Unicode characters (\u2028 and
\u2029) that cause Javascript errors, at least in Firefox, if not
escaped. So now we do so. Based on a patch from rleland.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 8931d8d68872f3b0742dafe02f4ab39d610c82e3 1 parent 499a8ac
@malcolmt malcolmt authored
4 django/template/
@@ -76,7 +76,9 @@ def capfirst(value):
('&', r'\x26'),
('=', r'\x3D'),
('-', r'\x2D'),
- (';', r'\x3B')
+ (';', r'\x3B'),
+ (u'\u2028', r'\u2028'),
+ (u'\u2029', r'\u2029')
# Escape every ASCII character with a value less than 32.
3  tests/regressiontests/defaultfilters/
@@ -83,6 +83,9 @@
>>> escapejs(ur'<script>and this</script>')
u'\\x3Cscript\\x3Eand this\\x3C/script\\x3E'
+>>> escapejs(u'paragraph separator:\u2029and line separator:\u2028')
+u'paragraph separator:\\u2029and line separator:\\u2028'
>>> fix_ampersands(u'Jack & Jill & Jeroboam')
u'Jack &amp; Jill &amp; Jeroboam'
Please sign in to comment.
Something went wrong with that request. Please try again.